Team:SYSU-Software/hm-overview.js

From 2014.igem.org

(Difference between revisions)
Line 1: Line 1:
-
    window.onload = function(){
+
$(function(){navigator.userAgent.indexOf("Firefox")>0&&($(".hm-part").css("transition","all 0s ease 0s"),$("#hm-part4 > div").css("transform","none"))}),window.onload=function(){function e(f,g){b&&(b=!1,1==a&&g>0?a=1:4==a&&0>g?a=4:(g>0?a--:a++,a=a%4||4),document.getElementById("bodyContent").className="hm-part"+a,setTimeout(function(){b=!0},1200),clearTimeout(c),d&&(c=setTimeout(function(){e("x",-1)},2e3)))}var a=parseInt(window.location.hash.slice(-1)),b=!0,c=setTimeout(function(){e("x",-1)},2e3),d=!0;document.getElementById("showpics").className="rotate",a=a>0&&5>a?a:1,document.getElementById("bodyContent").className="hm-part"+a,$(window).mousewheel(function(a,b){d=!1,clearTimeout(c),e(a,b)}),$(".hm-sequence > div").click(function(b){d=!1,clearTimeout(c),a=b.target.id.slice(-1),document.getElementById("bodyContent").className="hm-part"+a}),$(".hm-skip").click(function(){a=4,document.getElementById("bodyContent").className="hm-part"+a,d=!1,clearTimeout(c)})};
-
        var count = 1,
+
-
            wheel = true,
+
-
            auto;
+
-
        document.getElementById('showpics').className = 'rotate';
+
-
        document..getElementById('bodyContent').className="hm-part1";
+
-
        $(window).mousewheel(function(e, delta){
+
-
            switch(e,delta);
+
-
        });
+
-
    }
+
-
    function switch(e, delta){
+
-
    if(wheel){
+
-
            wheel = false;
+
-
            if(count==1 && delta>0){
+
-
                count=1;
+
-
            } else if(count==4 && delta<0){
+
-
                count=4;
+
-
            } else {
+
-
                delta > 0 ? count-- : count++;
+
-
                count = count%4 || 4;
+
-
            }
+
-
            document.getElementById('bodyContent').className = 'hm-part'+count;
+
-
            setTimeout(function(){
+
-
                wheel = true;
+
-
            }, 1500);
+
-
            clearTimeout(auto);
+
-
            auto = setTimeout(function(){
+
-
                switch('x', 1);
+
-
            },2000)
+
-
        }
+
-
    }
+

Revision as of 14:29, 17 October 2014

$(function(){navigator.userAgent.indexOf("Firefox")>0&&($(".hm-part").css("transition","all 0s ease 0s"),$("#hm-part4 > div").css("transform","none"))}),window.onload=function(){function e(f,g){b&&(b=!1,1==a&&g>0?a=1:4==a&&0>g?a=4:(g>0?a--:a++,a=a%4||4),document.getElementById("bodyContent").className="hm-part"+a,setTimeout(function(){b=!0},1200),clearTimeout(c),d&&(c=setTimeout(function(){e("x",-1)},2e3)))}var a=parseInt(window.location.hash.slice(-1)),b=!0,c=setTimeout(function(){e("x",-1)},2e3),d=!0;document.getElementById("showpics").className="rotate",a=a>0&&5>a?a:1,document.getElementById("bodyContent").className="hm-part"+a,$(window).mousewheel(function(a,b){d=!1,clearTimeout(c),e(a,b)}),$(".hm-sequence > div").click(function(b){d=!1,clearTimeout(c),a=b.target.id.slice(-1),document.getElementById("bodyContent").className="hm-part"+a}),$(".hm-skip").click(function(){a=4,document.getElementById("bodyContent").className="hm-part"+a,d=!1,clearTimeout(c)})};