The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Spoiler slideDown problem

View previous topic View next topic Go down

Spoiler slideDown problem

Post by jellalthesomewhatannoyed on Sun 10 Jun 2012, 12:37

I was trying to change my spoiler tag so that it slides down instead of toggles visibility with this custom jquery code:
Code:
$(".genmed").click(function() {
$(".spoiler_content").slideDown();
});
Although that seems to have no effect on it.
Did I mess up on the targets or is doing such a thing impossible?

jellalthesomewhatannoyed
New Member

Posts : 2
Reputation : 1
Language : English

Back to top Go down

Re: Spoiler slideDown problem

Post by +Fusion- on Sun 10 Jun 2012, 17:55

.onclick

+Fusion-
Forumember

Male Posts : 252
Reputation : 4
Language : English
Location : Flying

http://www.xcodezz.com

Back to top Go down

Re: Spoiler slideDown problem

Post by LGforum on Sun 10 Jun 2012, 18:20

Your problems not with the code, but possibly with the fact the other event listener is still attached, and so will execute at the same time... appearing as if the sliding is not happening.

What would need done would be to replace the spoilers with a clone, which removes all event listeners on it.
So it may be longer than you first thought:

Code:

$(function(){
  var s = $('.post .genmed');
  for(var i = 0, l = s.length; i<l; i++) {
    $(s[i]).replaceWith(s[i].cloneNode(true));
  }
  $('.post .genmed').click(function() {
    $('.spoiler_content', this.parentNode).slideDown();
  });
});
Try that and see if it works.

Your code would also (if it had worked) toggled all the spoilers on the page at the same time, when only one is clicked.

LGforum
Hyperactive

Male Posts : 2260
Reputation : 258
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: Spoiler slideDown problem

Post by jellalthesomewhatannoyed on Tue 12 Jun 2012, 11:40

Unfortunately that seemed not to have fixed it

jellalthesomewhatannoyed
New Member

Posts : 2
Reputation : 1
Language : English

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum