Team:Uppsala/JavaScript

From 2014.igem.org

(Difference between revisions)
Line 25: Line 25:
});
});
-
/*
 
-
jQuery(document).ready(function() {
 
-
 
-
  var button = ('#intro');
 
-
  $(button).click(function() {
 
-
  var op = $(button).css("opacity");
 
-
  if (op == 1)
 
-
{
 
-
  toggleVisibility('intro');
 
-
}
 
-
  });
 
-
 
 
-
 
-
});
 
-
*/
 
jQuery(document).ready(function() {
jQuery(document).ready(function() {
Line 53: Line 38:
{
{
   toggleVisibility('intro');
   toggleVisibility('intro');
-
   alert($zi);
+
   alert(hej);
}
}
   });
   });

Revision as of 19:10, 5 August 2014

jQuery(document).ready(function() {

   var button = ('.back-to-top'), timer;
   var offset = 500;
   var duration = 1000;
 jQuery(window).scroll(function() {
       if (jQuery(this).scrollTop() > offset) {
           jQuery(button).fadeIn(duration);
           clearTimeout(timer);
           timer = setTimeout(function() {
           jQuery(button).stop(true, true).fadeOut(duration);}, 2000);    
       }
        
        if (jQuery(this).scrollTop() < offset) {
        jQuery(button).fadeOut(duration);
        }
        
  });
      
   jQuery(button).click(function(event) {
       event.preventDefault();
       jQuery('html, body').animate({scrollTop: 0}, duration);
       return false;
   });

});


jQuery(document).ready(function() {


  $(document).click(function(e) {
  var button = $('.view');
  var op = $(button).css("opacity");
  var zi = $(button).css("z-index");


  if (!button.is(e.target) && op == 1)

{

  toggleVisibility('intro');
  alert(hej);

}

  });
  

});