Jquery.mousewheel to realize the effect of the whole screen turning screen _jquery

Source: Internet
Author: User

To achieve the whole screen upside down effect:
Need to load JS

<script type= "Text/javascript" src= "js/jquery-1.8.3.min.js" ></script>
<script type= "text/" JavaScript "src=" Js/jquery.mousewheel.js ></script>

The CSS styles are as follows:

body{padding:0;margin:0 Overflow:hidden}
ul{list-style:none;
content{width:100%;height100%;p osition:relative;top:0;
div_01,.div_02,.div_03,.div_04{width:100%;margin:0 auto; text-align:center;
Div_01{background: #b20909;
Div_02{background: #0941b2;
Div_03{background: #2db209;
Div_04{background: #b29c09;
left_fixed{position:fixed;width:15px; height:100px; left:100px;top:200px;z-index:999;
Left_fixed ul li{
  background: #000; cursor:pointer;width:15px;height:15px;
  border-radius:15px;margin-bottom:10px
}
. Left_fixed ul li.active{background: #fff;}

The jquery code is as follows:

var page=0;//screen variable, initial first screen var shakstaute = 0;
  This variable action is the mouse pulley has been down or sliding up when the jitter occurs $ (function () {var starttime = 0, endtime = 0; $ ("Body"). MouseWheel (function (event, delta) {starttime = new Date (). GetTime ()////////////////////////////// Amp  Page>=0 && page<=$ (". Content. Divsame"). Length-2) {if (shakstaute>=0 && (starttime = 0 | |
        (endtime-starttime) <=-500)) {//Perform a screen shakstaute=1 within 500ms;
        page++; Renderpage (page,true);  Flip-screen Function endtime = new Date (). GetTime ();  Record the end time of the rollover}} else if (delta>0 && page>=1 && shakstaute==1 && (starttime = = 0 | |
      (endtime-starttime) <= -500)) {page--;
      Renderpage (page,true);            
    Endtime = new Date (). GetTime ();
  }  
  }); 
  var div_height=$ (window). Height ();
  $ (". Divsame"). css ({' Height ':d iv_height});
    $ (window). Resize (function () {div_height=$ (window). Height (); $ (". Divsame"). css ({' Height ':d iV_height});
  $ ('. Content '). Animate ({top:-page*div_height}, 100);
  
  });
    $ (". Left_fixed ul Li"). On ("click", Function () {//Click small navigation also perform flip screen var index = $ (this). index ();
    if (index>0) {shakstaute==1;
    page = index;
    Renderpage (page, true);
    $ (". Left_fixed ul li"). Removeclass ("active");
    $ (this). AddClass ("active");
  return false;
  }); function Renderpage (pagenumber, Isscroll) {if (Isscroll) {$ ('. Content '). Animate ({top:-pagenumber*div_height}, ' SL
    Ow ');
    $ (". Left_fixed ul li"). Removeclass ("active");
  $ (". Left_fixed ul li"). EQ (pagenumber). addclass ("active");
} return;
 }
})

It is also a real-time response.

Let's look at an example.

Note that the head load of the Js,jquery library, Mousewheel.js has been implemented Index.js

<!doctype html>  

The

jquery code is as follows (Index.js):

var i=0;//flip-screen variable, initial first screen var s = 0;
  This variable action is the mouse pulley has been down or sliding up when the jitter occurs $ (function () {var starttime = 0, endtime = 0; $ ("Body"). MouseWheel (function (event, delta) {starttime = new Date (). GetTime ()////////////////////////////// ;& i>=0 && i<=2) {if (s>=0&& starttime = 0 | |
        (endtime-starttime) <=-500)) {//Perform a screen s=1 within 500ms;
        i++; Renderpage (i,true); Flip-screen Function endtime = new Date (). GetTime (); Record the end time of the rollover}} else if (Delta > 0&& i>=1&&s==1&& (starttime = 0 | |
      (endtime-starttime) <= -500)) {i--;
      Console.log (i);
      Renderpage (i,true);           
    Endtime = new Date (). GetTime ();

  }  

  }); 

  var div_height=$ (window). Height ();

  $ (". Div_01,.div_02,.div_03,.div_04"). css ({' Height ':d iv_height});

  $ (window). Resize (function () {var div_height=$ (window). Height ();

 $ (". Div_01,.div_02,.div_03,.div_04"). css ({' Height ':d iv_height}); }); function Renderpage (pagenumber, Isscroll) {if (Isscroll) {$ (' body, HTML '). Animate ({Scrolltop:pagenumber*div_h
        Eight}, ' slow ');
        $ (". Left_fixed ul li"). Removeclass ("active");
      $ (". Left_fixed ul li"). EQ (pagenumber). addclass ("active");
    } return;
    $ (". Left_fixed ul Li"). On ("click", Function () {//Click small navigation also perform flip screen var index = $ (this). index ();
    Renderpage (index, true);
    $ (". Left_fixed ul li"). Removeclass ("active");
    $ (this). AddClass ("active");
  return false;
});
 })

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.