Team:Heidelberg/js/frontpage
From 2014.igem.org
(Difference between revisions)
Line 12: | Line 12: | ||
}; | }; | ||
+ | |||
+ | $(document).bind('DOMMouseScroll mousewheel', function(e, delta) { | ||
+ | delta = delta || -e.originalEvent.detail / 3 || e.originalEvent.wheelDelta / 120; | ||
+ | wheel = true; | ||
+ | |||
+ | $scrollTop = Math.min($docH, Math.max(0, parseInt($scrollTop - delta * 30))); | ||
+ | $($.browser.webkit ? 'body' : 'html').stop().animate({ | ||
+ | scrollTop: $scrollTop + 'px' | ||
+ | }, 2000, 'easeOutQuint', function() { | ||
+ | wheel = false; | ||
+ | }); | ||
+ | return false; | ||
+ | }); | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
- | |||
controller = new ScrollMagic(); | controller = new ScrollMagic(); | ||
$("#ring").load(function(){ | $("#ring").load(function(){ |
Revision as of 10:02, 23 September 2014
recalcRingSize = function(setPosition) { var placeholder = $("#img-placeholder"); var ring = $("#ring"); var width = placeholder.outerWidth(false); var position = placeholder.offset(); position.left = position.left - $(".container").offset().left; if(setPosition){
ring.css(position);
} ring.css("width", width+"px"); placeholder.css("height", ring.height()+"px");
};
$(document).bind('DOMMouseScroll mousewheel', function(e, delta) {
delta = delta || -e.originalEvent.detail / 3 || e.originalEvent.wheelDelta / 120; wheel = true;
$scrollTop = Math.min($docH, Math.max(0, parseInt($scrollTop - delta * 30))); $($.browser.webkit ? 'body' : 'html').stop().animate({ scrollTop: $scrollTop + 'px' }, 2000, 'easeOutQuint', function() { wheel = false; }); return false;
});
$(document).ready(function(){
controller = new ScrollMagic(); $("#ring").load(function(){ recalcRingSize(true); $("#img-placeholder img").css("display", "none"); $("#ring").css("visibility", ""); //skrollr.get().refresh(); }); var ringTween = new TweenMax("#ring", 2, { rotation: 360, left: -200, top: 600}); var scene = new ScrollScene({duration: 600})
.setTween(ringTween) .addTo(controller);
scene.addIndicators();
//skrollr.init();
});
$( window ).resize(function() { recalcRingSize(false); //skrollr.get().refresh(); });