Template:Team:Leeds Vallenatojs

From 2013.igem.org

(Difference between revisions)
(js jquery program for web elements, originally from switchroyale)
m (Instructions on use)
 
(2 intermediate revisions not shown)
Line 6: Line 6:
  *  
  *  
  * Use Vallenato for whatever you want, enjoy!
  * Use Vallenato for whatever you want, enjoy!
 +
*
 +
* To use within wiki, paste in the following url as the src:
 +
* https://2013.igem.org/Template:Team:Leeds_Vallenatojs?action=raw&ctype=text/javascript
  */
  */
-
$(document).ready(function()
+
$(document).ready(function(){$(".accordion-header").toggleClass("inactive-header");var e=$(".accordion-header").width();$(".accordion-content").css({width:e});$(".accordion-header").click(function(){if($(this).is(".inactive-header")){$(".active-header").toggleClass("active-header").toggleClass("inactive-header").next().slideToggle().toggleClass("open-content");$(this).toggleClass("active-header").toggleClass("inactive-header");$(this).next().slideToggle().toggleClass("open-content")}else{$(this).toggleClass("active-header").toggleClass("inactive-header");$(this).next().slideToggle().toggleClass("open-content")}});return false})
-
{
+
-
//Add Inactive Class To All Accordion Headers
+
-
$('.accordion-header').toggleClass('inactive-header');
+
-
+
-
//Set The Accordion Content Width
+
-
var contentwidth = $('.accordion-header').width();
+
-
$('.accordion-content').css({'width' : contentwidth });
+
-
+
-
+
-
+
-
// The Accordion Effect
+
-
$('.accordion-header').click(function () {
+
-
if($(this).is('.inactive-header')) {
+
-
$('.active-header').toggleClass('active-header').toggleClass('inactive-header').next().slideToggle().toggleClass('open-content');
+
-
$(this).toggleClass('active-header').toggleClass('inactive-header');
+
-
$(this).next().slideToggle().toggleClass('open-content');
+
-
}
+
-
+
-
else {
+
-
$(this).toggleClass('active-header').toggleClass('inactive-header');
+
-
$(this).next().slideToggle().toggleClass('open-content');
+
-
}
+
-
});
+
-
+
-
return false;
+
-
});
+

Latest revision as of 15:31, 2 September 2013

/*!

* Vallenato 1.0
* A Simple JQuery Accordion
*
* Designed by Switchroyale
* 
* Use Vallenato for whatever you want, enjoy!
*
* To use within wiki, paste in the following url as the src:
* https://2013.igem.org/Template:Team:Leeds_Vallenatojs?action=raw&ctype=text/javascript
*/

$(document).ready(function(){$(".accordion-header").toggleClass("inactive-header");var e=$(".accordion-header").width();$(".accordion-content").css({width:e});$(".accordion-header").click(function(){if($(this).is(".inactive-header")){$(".active-header").toggleClass("active-header").toggleClass("inactive-header").next().slideToggle().toggleClass("open-content");$(this).toggleClass("active-header").toggleClass("inactive-header");$(this).next().slideToggle().toggleClass("open-content")}else{$(this).toggleClass("active-header").toggleClass("inactive-header");$(this).next().slideToggle().toggleClass("open-content")}});return false})