Toggle one element at time using Appdev WordPress theme

Toggle one element at time using Appdev WordPress theme

Hello,

Are you building your own website using Appdev theme but you are stuck to toggle one element at time inside your page? Here is a simple solution I’ve found when I’ve faced the same problem.

    1. Go to your js folder following your theme installation path (mine is public_html/wp-content/themes/appdev/js)
    2. Right click on main.js file and select “Code edit”
      code_edit
    3. Press the Search button (CTRL+F on Windows) and find the string $(".toggle-label")
      search
    4. Insert before $(“.toggle-label").toggle{..} the following lines:


$(".toggle-label").click(function(){
var $this = $(this);
//Closing an item previously opened by click.
if($this.parent(".active-toggle").length > 0){
$this.parent(".active-toggle").removeClass(".active-toggle");
$this.find('.toggle-content').slideUp("fast");
return false;
}
$('.so-widget-mo-toggle').find(".active-toggle").removeClass("toggle active-toggle").addClass("toggle");
$('.so-widget-mo-toggle').find('.toggle-content').slideUp("fast");
return false;
});

After that modify, your event handler function should be like this:
result

 

Save everything and your website will display one toggle element at time.
Simple, isn’t it?

See you soon at the next post!
Gabriele

Leave a Reply

%d bloggers like this: