Web Design Forum: Any jQuery experts? - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Any jQuery experts?

#1 User is offline   craftedpixelz 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 644
  • Joined: 28-June 08
  • Reputation: 5
  • Gender:Male
  • Location:Manchester, UK
  • Experience:Web Guru
  • Area of Expertise:Web Designer

Posted 02 January 2010 - 09:40 PM

EDIT:

I've solved it!

Thanks for the help guys.
0

#2 User is offline   Mark L Bentley 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 279
  • Joined: 04-June 08
  • Reputation: 13
  • Gender:Male
  • Location:Cambridge
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 02 January 2010 - 10:47 PM

There's a problem in this line

$('a.toggle[name='+id+']').toggle();


You've got single quotes inside single quotes which won't work.

If you haven't already, get firefox with firebug and web developers toolbar for testing. It'll show you errors and tell you what's going on.
0

#3 User is offline   craftedpixelz 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 644
  • Joined: 28-June 08
  • Reputation: 5
  • Gender:Male
  • Location:Manchester, UK
  • Experience:Web Guru
  • Area of Expertise:Web Designer

Posted 03 January 2010 - 12:03 AM

It works fine at the moment with the single quotes funnily enough. The code shown there doesn't have any implementation of the cookie plugin. I was hoping someone would be able to steer me in the right direction of the code I'd need to write up to get it working.
0

#4 User is offline   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,813
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 03 January 2010 - 10:51 AM

Have only used the cookie plugin a couple of times but all you need to do add the following line into your toggle function - including a check for the original cookie:

if ($('a.toggle[name='+id+']').is(":hidden")) {  
   
   $("'a.toggle[name='+id+']'").slideDown("slow");  
   $(this).addClass("active");  
   $.cookie('showTop', 'collapsed');  
   return false;  
  
 } else {  
   
   $('a.toggle[name='+id+']').slideUp("slow");  
   $(this).removeClass("active");  
   $.cookie('showTop', 'expanded');  
   return false;  
   
}  


That is from a really good example I found ages ago, but can't find the link. I'll have a look for it.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users