Team:ATOMS-Turkiye/Templates/AutohideContent

From 2013.igem.org

(Difference between revisions)
(Created page with "<html> <script> function toggleContent(){ next = $(this).next(); if(next.is(':animated')) next.stop(); if(next.hasClass("contentVisible")) { next.removeClass("con...")
 
(10 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
 +
<style>
 +
.mw-headline
 +
{
 +
  cursor: pointer;
 +
}
 +
</style>
<script>
<script>
function toggleContent(){
function toggleContent(){
-
   next = $(this).next();
+
   next = $(this).parent().next();
   if(next.is(':animated'))
   if(next.is(':animated'))
-
   next.stop();
+
   return;
   if(next.hasClass("contentVisible"))
   if(next.hasClass("contentVisible"))
   {
   {
     next.removeClass("contentVisible")
     next.removeClass("contentVisible")
-
     next.show();
+
     next.show(300);
   }
   }
   else
   else
   {
   {
-
     next.add("contentVisible");
+
     next.addClass("contentVisible");
-
     next.hide();
+
     next.hide(300);
   }
   }
}
}
$(document).ready(function(){
$(document).ready(function(){
-
   $(".article mw-headline").click(toggleContent);
+
   $(".article h2 .mw-headline").click(toggleContent);
 +
  a = $(".article h2 .mw-headline").parent().next();
 +
  a.addClass("contentVisible");
 +
  a.hide();
 +
  a = a.eq(0);
 +
  a.removeClass("contentVisible");
 +
  a.show();
 +
 
});
});
</script>
</script>
</html>
</html>

Latest revision as of 00:51, 5 October 2013