Difference between revisions of "Template:Team:TU Darmstadt/Js"

Line 41: Line 41:
  
 
// END ScrollBox
 
// END ScrollBox
$( function() {
+
 
    function runEffect() {
+
function runEffect() {
 
$("button #lw1c").click(function(){
 
$("button #lw1c").click(function(){
 
     $("#lw1").toggle();
 
     $("#lw1").toggle();
 
});
 
});
}});
+
};

Revision as of 21:47, 15 October 2016

// START MainMenu

$(window).load(function() {

 var distance = $('#title').outerHeight() + 5,
 $window = $(window);
 
 $window.scroll(function() {
   if ( $window.scrollTop() >= distance ) {
     $('.navbar').addClass('top-fixed');
   } else if ( $window.scrollTop() <= distance && $('.navbar').hasClass('top-fixed') ) {
     $('.navbar').removeClass('top-fixed');
   }
 });

});

// END MainMenu // START ScrollBox

$(window).scroll(function(e) {

 var $element = $('.scrollbox');
 var headerHeight = $('#head').outerHeight() - 30;
 var isFixed = ($element.css('position') == 'fixed');
 if ($(this).scrollTop() > headerHeight) {
   if(!isFixed) {
       $element.addClass("scrolled");
   }
 }
 if ($(this).scrollTop() < headerHeight) {
   if(isFixed) {
       $element.removeClass("scrolled");
   }
 }

});

function scrollToTop() {

 $('body,html').animate({
   scrollTop: 0
 }, 400);

}

// END ScrollBox

function runEffect() { $("button #lw1c").click(function(){

   $("#lw1").toggle();

}); };