Skip to content Skip to sidebar Skip to footer

Adapt Code Inside Dokuwiki Spoilers Style?

To change selector so it only show/hides when i click the image i put spoiler/ popdown menu directly after .OS image. Right now the popdown is a child of the .OS container, so clic

Solution 1:

This code works:

 $(document).ready(function(){
 $(".nonjs").removeAttr( "href"); 
//href is needed for users without JS

 $('.OS').click(function(e){
           if(!$(e.target).parents('.details').length){
                        if($(this).find('.details').is(":visible"))
                        {
                            $(this).find('.details').not(":hidden").hide("slow");
                            returntrue;
                        }
                        else
                        {

                            $(this).find('.details').show("slow");
                            returnfalse;
                        }
          }
});
 }); 

Solution 2:

I don't know what you're asking but here is what I think you want:

When clicking on an image, show the details below it and hide all others. If the details are already visible, hide them. Clicking something inside the details should not affect anything.

Demo

$(document).ready(function(){
  $(".nonjs").removeAttr( "href"); //href is needed for users without JS
  $('.OS').click(function(){
    var details = $(this).next(".details");
    $(".details").hide("slow");
    if(details.is(":hidden")) {
      details.show("slow");
    }
  });
});

Post a Comment for "Adapt Code Inside Dokuwiki Spoilers Style?"