aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT
Advertise Here

Advertize

wwwSW
Posted by Aamir Hasan   on Sunday, November 7, 2010 Total Views:  

Hi every one, in my previous article Expand collapse div using jQuery - Part -1. I had told you about toggle div. In this example, a simple solution of toggle multiple div using jQuery, clicking on div heading will expand/collapse the select content.

 

Here's an example.

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

   <title>How to expand collapse multiple div layer using </title>

  <script src="http://code.jquery.com/jquery-1.4.3.min.js" type="text/javascript"></script>

   <style type="text/css">

       body

       {

           background: #FFF;

           font-size: .90em;

           font-family: "Helvetica Neue" , "Lucida Grande" , "Segoe UI" , Arial, Helvetica, Verdana, sans-serif;

           margin: 10px;

           padding: 0px;

       }

       #toggle

       {

           width: 400px;

           display: block;

       }

       .heading

       {

           background-color: #666;

           height: 25px;

           padding: 5px 5px;

           color: #fff;

           cursor: pointer;

           position: relative;

           border-bottom:1px solid #fff;

       }

       

       .content

       {

           line-height: 20px;

           background-color: #eee;

           min-height: 100px;

           padding: 15px;

       }

   </style>

   <script language="javascript">

       $(document).ready(function () {

           $(".content").hide();

           $(".heading").click(function () {

               $(this).next(".content").slideToggle(100);

           });

       });

   </script>

</head>

<body>

   <form id="form1" runat="server">

   <div>

       <h2>

           How to expand collapse multiple div layer using </h2>

       <div id="toggle">

           <div class="heading">

               Heading 1</div>

           <div class="content">

               <p>

                   content 1

               </p>

           </div>

           <div class="heading">

               Heading 2</div>

           <div class="content">

               <p>

                   content 2

               </p>

           </div>

           <div class="heading">

               Heading 3</div>

           <div class="content">

              <p>

                   Author:Aamir Hasan<br />

                   Date: November 07, 2010<br />

                   www.aspxtutorial.com

               </p>

           </div>

       </div>

   </form>

</body>

</html>

Output

Download

Mutil Div toggle.zip (1.33 kb)

Live demo

Category: All | asp.net | CSS | jQuery
Protected by Copyscape Online Plagiarism Tool

Comments (12) -

Texas em Poker
Texas em Poker United States
12/15/2010 8:50:23 PM #

Great Post Thanks !

Real Casino Player
Real Casino Player United States
12/15/2010 8:50:47 PM #

Nice Post Thanks

Mahwish Akhtar
Mahwish Akhtar
12/18/2010 4:38:52 AM #

error on the demo page, aany one can upload it again.

live tv on your pc
live tv on your pc United States
2/20/2011 11:38:05 PM #

My spouse and i got so contented that Edward could deal with his studies using the ideas he gained through the site. It's not at all simplistic to just find yourself giving away facts which some people may have been selling. And we do know we have got the website owner to give thanks to because of that. The explanations you have made, the easy website navigation, the relationships you make it easier to create - it's got mostly terrific, and it's really aiding our son and us imagine that the situation is cool, and that is very serious. Thanks for the whole thing!

GHD Straighteners Sale
GHD Straighteners Sale Macedonia (FYROM)
4/10/2011 4:39:07 PM #

GHD straighteners are available in there different sizes - Original or sometimes refered to as medium, the widesalon styler and the mini styler.

Lateralus138
Lateralus138 United States
4/7/2012 4:17:54 PM #

Thanks a lot for this, I only know HTML and CSS well, but I'm just learning javascript and this is perfect for what I'm doing on my site.

Lateralus138
Lateralus138 United States
4/7/2012 4:18:09 PM #

Thanks a lot for this, I only know HTML and CSS well, but I'm just learning javascript and this is perfect for what I'm doing on my site.

Lateralus138
Lateralus138 United States
4/7/2012 4:18:42 PM #

Thanks a lot for this, I only know HTML and CSS well, but I'm just learning javascript and this is perfect for what I'm doing on my site.

Ian Pride
Ian Pride United States
4/7/2012 4:19:07 PM #

Thanks a lot for this, I only know HTML and CSS well, but I'm just learning javascript and this is perfect for what I'm doing on my site.

Lateralus138
Lateralus138 United States
4/7/2012 4:19:30 PM #

Thanks a lot for this, I only know HTML and CSS well, but Im just learning javascript and this is perfect for what Im doing on my site.

Lateralus138
Lateralus138 United States
4/7/2012 4:19:45 PM #

Thanks a lot for this, I only know HTML and CSS well, but Im just learning javascript and this is perfect for what Im doing on my site.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5