NetEase Games js-Scrolling support adaptive

Source: Internet
Author: User

Nie.config.copyRight.setGray (); var Niecarousel = (function ($) {var defaultoptions = {children: '. center-slide -box a ', nextbtn: '. Slide-next ', prevbtn: '. Slide-prev ', Navlist: '. Center-slide-nav li ', Box: '    . Center-slide ', Resnav: '. Center-slide-res-nav li ', autoplay:true} var current = 0;    var tempcurrent=0;//for click event var transfer = false;        var Niecarousel = function (box, options) {this.options = $.extend ({}, defaultoptions, options);        This._$children = $ (This.options.children);        This._$nav = $ (this.options.navList);        this._$resnav=$ (THIS.OPTIONS.RESNAV);        This._num = This._$children.length;        This._autoplay=this.options.autoplay;        this._$box=$ (This.options.box);    This.init ();        } NieCarousel.prototype.initNext = function () {var = this;        var num = self._num;        var $ele = $ (SELF.OPTIONS.NEXTBTN); function Shownext () {iF (!transfer) {transfer = true; if (current+1==self._num) {self._$children.eq (0). css ({left: ' 100% '}} "self"                . _$CHILDREN.EQ (current% num). Animate ({left: '-100% '}, 300);                    SELF._$CHILDREN.EQ (++current% num). Animate ({left: ' 0% '}, +, function () {                    Transfer = FALSE;                    Self._$children.eq ((current-1)%num). css ({' Left ': '-100% '});                Self._$children.eq ((current+1)). css ({' Left ': ' 100% '})});            Navtransfer ();            }} function Navtransfer () {current%num==0?current=0: '; $ ('. Center-slide-nav li. Default '). EQ (current-1). Animate ({top: ' 0 '}). Parent (). Removeclass (' on ')            ; $ ('. Center-slide-nav li. Default '). EQ (current). Animate ({top: ' -100% '}). Parent (). addclass(' on ');            Self._$resnav.eq (current), addclass (' on ');            Self._$resnav.eq (current-1). Removeclass (' on '); if (self.settimeoutid&&! (                $.browser.msie&& $.browser.version== ' 6.0 ') {$ ('. Progress-inner '). Removeclass (' progress-loading ');            $ ('. Progress-inner '). EQ ((current+1)%self._num). addclass (' progress-loading ');    }} $ele. Click (shownext);        } NieCarousel.prototype.initPrev = function () {var = this;        var num = self._num;        var $ele = $ (SELF.OPTIONS.PREVBTN);                function Showprev () {if (!transfer) {transfer = true; if (current%self._num==0) {Self._$children.eq ( -1). css ({left: ' -100% '})} SE                LF._$CHILDREN.EQ (current% num). Animate ({left: ' 100% '}, 300);         SELF._$CHILDREN.EQ (--current% num). Animate ({left: ' 0% '       }, 300,function () {transfer=false;                    Self._$children.eq ((current-1)%num). css ({' Left ': '-100% '});                Self._$children.eq ((current+1)%num). css ({' Left ': ' 100% '})});                Navtransfer ();            Current%num==0?current=0: "; }} function Navtransfer () {self._$nav.find ('. Default '). EQ (current+1). Animate ({To            P: ' 0 '}). Parent (). Removeclass (' on ');            Self._$nav.find ('. Default '). EQ (current). Animate ({top: ' -100% '}). "Parent (). addclass (' on ');            Self._$resnav.eq (current), addclass (' on ');        Self._$resnav.eq (current+1). Removeclass (' on ');    } $ele. Click (Showprev);        } NieCarousel.prototype.initNav = function () {var = this;            function Setnavclickfn (index) {tempcurrent=current;            Current=index;            var LeftPos; if (!transfer&& (TEMpcurrent!=current)) {transfer=true;                Self._$nav.eq (tempcurrent). Removeclass (' on ');                Self._$resnav.eq (tempcurrent). Removeclass (' on ');                Self._$nav.eq (tempcurrent). Find ('. Default '). Animate ({top:0})                $ (this). addclass (' on ');                Current>tempcurrent?leftpos= ' -100% ': leftpos= ' 100% '; Current>tempcurrent?self._$children.eq (current). CSS (' left ', ' 100% '): Self._$children.eq ("current") CSS (' Left ', '                -100% '); Self._$children.eq (tempcurrent). Animate ({Left:leftpos}) Self._$children                    . EQ (current). Animate ({left:0},function () {transfer=false;                            Self._$children.not (current). each (function (index) {if (index>current) {                     $ (this). CSS ({left: ' 100% '})}else{       $ (this). CSS ({left: ' -100% '})} if (index==current) {        $ (this). CSS (' left ', ' 0 ')}})}}} Self._$nav.each (function (index) {$ (this). Hover (function () {Self._$nav.not ('. on '). Find ('. Default '). Stop (). Animate ({top: ' 0 '}) self._$nav.eq (index). Find ('. Default '). Stop (). Animate ({top: ' -100% '})},function () {!$ (this). HASC            Lass (' on ') &&$ (this). Find ('. Default '). Animate ({top: ' 0 '})})            $ (this). Click (function () {setnavclickfn.call (this,index);        }); }) Self._$resnav.each (function (index) {$ (this). Click (function () {Setnavclickfn.call (            index); })})} NiecarouSel.prototype.autoPlay = function () {var self=this; This.settimeoutid=setinterval (function () {$ (SELF.OPTIONS.NEXTBTN). Trigger (' click ')},3000)} Nieca        Rousel.prototype.hoverevent=function () {var self=this;            Self._$box.hover (function () {clearinterval (Self.settimeoutid);  Self.settimeoutid=0;        Watch if user click or Auto play $ ('. Progress-inner '). Removeclass (' progress-loading ');            },function () {self._autoplay&&self.autoplay (); self._autoplay&&! ($.browser.msie&& $.browser.version== ' 6.0 ') &&$ ('. Progress-inner '). EQ ((current+1)%self._num).        AddClass (' progress-loading ');        })} niecarousel.prototype.initdefault=function () {var = this;        var isFirst = false;            This._$children.each (function (index) {index = = 0? isFirst = True:isfirst = false; (!isfirst) && $ (this). css ({left: ' 100% '});        This._$nav.find ('. Num '). Each (function (i) {$ (this). html (i+1);        }) This._$nav.eq (0). addclass (' on '). Find ('. Default '). CSS (' top ', '-100% '); this._autoplay&&! ($.browser.msie&& $.browser.version== ' 6.0 ') &&$ ('. Progress-inner '). EQ (1). addclass ('    Progress-loading ');        } nieCarousel.prototype.init = function () {this.initdefault ();        This.initnext ();        This.initprev ();        This.initnav ();        This._autoplay&&this.autoplay ();    This.hoverevent (); } return Niecarousel;})    (jQuery); $ (function () {//set default speeds!override $.fx.speeds._default $.fx.speeds._default=300; var carousel = new Niecarousel ('. Center-slide-box ', {children: '. Center-slide-box a ', nextbtn: '. Slide-next    ', prevbtn: '. Slide-prev ', Navlist: '. Center-slide-nav li ', autoplay:true}); /** * Window Resize Set Height */$ (window). Resize(function () {if (window). Width () <1000) {$ ('. Center-slide '). Height ($ ('. Center-slide '). Width ()                *0.55);            $ ('. Center-news '). Height ($ ('. Center-slide '). Height () +1);                }else{$ ('. Center-news '). Height (405);            $ ('. Center-slide '). Height (406); if (window). Width () <768) {}}) if ($ (window). Width () <1000) {$ ('. Center-slide ').        Height ($ ('. Center-slide '). Width () *0.55);    $ ('. Center-news '). Height ($ ('. Center-slide '). Height () +1);        }else{$ ('. Center-news '). Height (405);    $ ('. Center-slide '). Height (406); }//entrance-list-res (function () {var $ele = $ ('. Entrance-list-ul li:not (. entrance-list-btn) '), le  Ngth= $ele. Length, Next=true, Prev=false, status=length%9; For 768 function ipadentrance () {next&& (function () {$ ('. Entrance-list-next '). Re Moveclass (' disabled ');               $ ('. Entrance-list-prev '). addclass (' disabled ');                $ele. Removeclass (' res-hide ');                for (Var index=-status;index<0;index++) {$ele. EQ (index). addclass (' res-hide ');            }            }());                prev&& (function () {$ ('. Entrance-list-prev '). Removeclass (' disabled ');                $ ('. Entrance-list-next '). addclass (' disabled ');                $ele. Removeclass (' res-hide ');                for (Var index=0;index<status;index++) {$ele. EQ (index). addclass (' res-hide ');        }            }());        } ipadentrance ();            $ ('. Entrance-list-btn '). Click (function () {next=!next;            Prev=!prev;        Ipadentrance ();    })    })(); var entrancescroll= (function () {var $ele =$ ('. Entrance-list-ul li:not (. entrance-list-btn) '), $next =$ ('. En Trance-list-next '), $prev =$ ('. Entrance-list-prev '), $eleNav =$ ('. entrAnce-list-nav a '), length= $ele. Length, nowcount= 0, Groups=math.ceil (LENGTH/4),        cls=0;            for (Var i=0;i<length;i++) {$ele. EQ (i). addclass (' res-group-' +cls);            (i+1)%4==0?++cls: ";        I>3 ": $ele. EQ (i). addclass (' res-group-show ');                    } function init () {$next. Click (function () {var current= (++nowcount)%groups,                domele=$ ('. res-group-' +current);                $ele. Removeclass (' res-group-show ');                Domele.addclass (' res-group-show ');                $eleNav. Removeclass (' current '), EQ (current), addclass (' current ');            Nowcount%groups==0?nowcount=0: "; }) $prev. Click (function () {var current= (--nowcount)%groups, ii=current<0? (                current+groups): Current domele=$ ('. res-group-' +ii);                $ele. Removeclass (' res-group-show '); Domele.addclass (' Res-grOup-show ');                $eleNav. Removeclass (' current '), EQ (current), addclass (' current ');            Nowcount%groups==0?nowcount=0: ";                    }) $eleNav. Each (function (i) {$ (this). Click (function () {nowcount=i;                    $eleNav. Removeclass (' current '). EQ (i). addclass (' current ');                    var domele=$ ('. res-group-' +i);                    $ele. Removeclass (' res-group-show ');                Domele.addclass (' res-group-show ');    })})} return{Init:init}} ()) Entrancescroll.init ();    Mobile-list-res added by MrF 2014-5-8 var mgamelength = $ ('. Mgame-list-pic '). Find (' Li '). Length,len; mgamelength%3 = = 0?len = parseint (MGAMELENGTH/3): len = parseint (MGAMELENGTH/3) +1 for (var i = 0;i<len;i++) {$ ( '. Mgame-list-pic-nav '). Append (' <a class= ' Mgame-list-pic-nav-tab "href=" javascript:void (0) "><div class=" Mgame-list-pic-nav-tab-bar "></div></a> ');    } $ ('. Mgame-list-pic-nav-tab '). EQ (0). addclass (' current ');        $ ('. Mgame-list-pic-nav-tab '). Hover (function () {var num = $ (this). index ();        $ (this). AddClass ("current");        $ (this). Siblings (). Stop (False,true). Removeclass (' current ');    $ ('. Mgame-list-pic '). Stop (). Animate ({' Left ': num* ( -1017) + ' px '},250); })})

Scrolling HTML code

<section class= "Center-slide" ><div class= "Center-slide-box" ><a href= "http://gad.netease.com/gad/ Access?project_id=1035062&s=sddbs%2b1kjksihvkdv3oz4d8oob8%3d&code_type=1 "target=" _blank "></a><a href= "http// txhd.163.com/"target=" _blank "></a><a href= "http://xy3.163.com/" target= "_blank" ></a><a href=" http://gad.netease.com/gad/ Access?project_id=1034900&s=gnbeqhwpvpvxwpcuplaouw1mmc0%3d&code_type=1 "target=" _blank "></a><a href="/http/ Yzr.163.com "target=" _blank "></a><span class=" Slide-next "></span><span class=" Slide-prev "></ Span></div><ul class= "Center-slide-nav" ><li><a href= "javascript:;" class= "Default" > <span class= "num" >1</span><div class= "Progress" ><div class= "Progress-inner" ></div> </div><span class= "title" > Live Club Carnival </span></a><a href= "javascript:;" class= "hover" > <div class= "Mask" ></div><div class= "Content" ><p> Live Club Carnival </p><span> View details <i></i></span></div></a> </li><li><a href= "javascript:;" class= "Default" ><span class= "num" >1</span><div Class= "Progress" ><div class= "Progress-inner" ></div></div><span class= "title" > World HD Evil Moe Open test </span></a><a href= "javascript:;" class= "hover" ><div class= "Mask" ></div>&Lt;img src= "http://nie.163.com/banner/13v1/nie_txhd0707.jpg" ><div class= "content" ><p> World HD Fierce Open test < /p><span> View Details <i></i></span></div></a></li><li><a href= " javascript:; "class=" Default "><span class=" num ">1</span><div class=" Progress "><div class=" Progress-inner "></div></div><span class=" title "> New big Talk 3 new data sheet </span></a><a href= "javascript:;" class= "hover" ><div class= "mask" ></div><div class=" Content "><p> new 3 new info sheet </p><span> View details <i></i> </span></div></a></li><li><a href= "javascript:;" class= "Default" ><span class= "num" >1</span><div class= "Progress" ><div class= "Progress-inner" ></div></div ><span class= "title" > Ninja Must die 2 new version </span></a><a href= "javascript:;" class= "hover" >&Lt;div class= "Mask" ></div><div class= "Content" ><p> Ninja must die 2 new version </p><span> view Details <i></i></span></div> </a></li><li><a href= "javascript:;" class= "Default" ><span class= "num" >1</span ><div class= "Progress" ><div class= "Progress-inner" ></div></div><span class= "title" > Shadow Blade Ultimate Test </span></a><a href= "javascript:;" class= "hover" ><div class= "Mask" ></div> <div class= "content" ><p> Shadow Blade Ultimate Seal Test </ p><span> View Details <i></i></span></div></a></li></ul><ul class= " Center-slide-res-nav "><li class=" on "><a href=" JavaScript "></a></li><li><a href= "JavaScript" ></a></li><li><a href= "JavaScript" ></a></li><li>& LT;a href= "javascript" ></a></li><li><a href= "JavaScript" ></a></li></ul ></section>

NetEase Games js-scrolling support adaptive

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.