Ad Space
Ad Space

Hosting Geared For
your CMSMS needs

CMSMS ready Hosting

Hosting Starting at $15

  • • Hosted Mail
  • • Personal Control Panel
  • • CMSMS 1.8.1 tested
  • • Lightly packed servers
  • • Intrusion Detection
  • • URL monitored
  • • Custom solutions available

Order your hosting Now

CP Blogs

Expand and Contract

Posted by: Jeremy Bass
on Jul 5, 2009

Category:

Coding, Basics, Presentation, jQuery

Summary:

Hello, here is a light weight way to Expand and Contract div's, span's, or what have you...


Ad Space

Hello, here is a light weight way to Expand and Contract div's, span's, or what have you...

Javascript - jQuery
 $(".extendHANDLE").click(function(){ if($(this).next().hasClass("Nextend")){ $(this).find("span").text("[-]"); $(this).next().slideDown("fast"); $(this).next().removeClass("Nextend"); $(this).next().addClass("extend"); }else{ $(this).next().slideUp("fast"); $(this).find("span").text("[+]"); $(this).next().addClass("Nextend"); $(this).next().removeClass("extend"); } }); 
HTML
 

Get Social With It

[+]
what have you.
CSS
 .Nextend{ display:none;} 

Note: To have one start open just just .extend inplace of .Nextend

Simple, but it still needs jQuery.

The demo is all over... just look for [+] ;)

Ad Space

Get Social With It

[+]
  • #1
    test
    jeremy - July 6, 2009, 7:15 pm
    test
  • #2
    test2
    jeremy - July 6, 2009, 9:35 pm
    asdfasdfdfasdf

Add A Comment

[+]

Code in the picture:
Title:
Your Name(*):
Email:
Notify me of any further comments to this thread:
Website:
Comment(*):
 
Previous page: Hosting FAQ Next page: Experimental