| $ (Function (){ WordStrong (); $ ("# Content ul"). width ($ ("# content ul li: first"). width () * $ ("# content ul li"). length ); $ ("# Header. top_right. vote"). hover (function (){ $ (This). children (". hover-tip" ).css ("display", "block "); $ (This). children (". num" ).css ("display", "none "); }, Function (){ $ (This). children (". hover-tip" ).css ("display", "none "); $ (This). children (". num" ).css ("display", "block "); }); $ ("# Content. left, # content. right "). width ($ (document ). width ()-$ ("# content "). width ()/4 ); $ ("# Content. left" ).css ("left",-$ ("# content. left"). width ()); $ ("# Content. right" ).css ("right",-$ ("# content. right"). width ()); Var showId = 0; $ ("# Content span. left"). hover (function (){ If (checkFirst () return; Vertex (this).css ("cursor", "pointer "); $ (This). siblings (". sl"). stop (). animate ({ Opacity: 0.5 }); }, Function (){ $ (This). siblings (". sl"). stop (). animate ({ Opacity: 0 }); }). Click (function (){ If (checkFirst () return; ShowId --; $ ("# Content"). attr ("showId", showId ); $ ("# Footer li"). children (). removeClass ("active"). end (). children (). eq (showId). addClass ("active "); Center (showId ); }); $ ("# Content span. right"). hover (function (){ If (checkLast () return; Vertex (this).css ("cursor", "pointer "); $ (This). siblings (". sr"). stop (). animate ({ Opacity: 0.5 }); }, Function (){ $ (This). siblings (". sr"). stop (). animate ({ Opacity: 0 }); }). Click (function (){ If (checkLast () return; ShowId ++; $ ("# Content"). attr ("showId", showId ); $ ("# Footer li"). children (). removeClass ("active"). end (). children (). eq (showId). addClass ("active "); Center (showId ); }); Function checkFirst (){ If ($ ("# content"). attr ("showId") = 0 ){ $ ("# Content span. left" ).css ("cursor", "default "); Return true; } Return false; } Function checkLast (){ If ($ ("# content"). attr ("showId") ==$ ("# content ul li"). length-1 ){ $ ("# Content span. right" ).css ("cursor", "default "); Return true; } Return false; } /* Uppercase letters */ Function wordStrong (){ Var liList = $ ("# content ul li "); For (var j = 0; j <liList. length; j ++ ){ Var pList = $ ("# content. cont _" + (j + 1) + ". cont_word p "); For (var I = 0; I <pList. length; I ++ ){ Var p = pList. get (I ); Var pCont = (p).html (); Var s = $ ("<B>" + (I + 1) + "</B> "); S.css ("font-size", "24px "); Certificate (p).html (''); S. appendTo (p ); $ (P). append (pCont. substring (1 )); } } } Center (0 ); // Center relative to li Function center (liIndex ){ Var li = $ ("# content ul li" ).css ("opacity", 0.32.16.eq(liindex).css ("opacity", 1 ); $ ("# Content ul"). animate ({ Left: (-li. width () * liIndex) }); } Var footLen = $ ("# content ul li"). length; Var foots = $ ("# footer ul "); For (var I = 1; I <footLen-1; I ++ ){ Var childA = $ ("<a>" cmd.html (I ); ChildA. attr ("href ","#"); $ ("<Li>"). append (childA). insertBefore (foots. children ("[step = last]"). attr ("step", I ); } Foots. children (": last"). attr ("step", footLen-1 ); Foots.css ("left", ($ (window). width ()-foots. width ()/2 ); $ ("# Footer li"). click (function (){ $ ("# Footer ul li"). children (). removeClass ("active "); $ (This). children (). addClass ("active "); Center ($ (this). attr ("step ")); }); Function myAddEvent (obj, e, fn ){ If (obj. attachEvent ){ Obj. attachEvent ('on' + e, fn ); } Else obj. addEventListener (e, fn, false ); } Function onMouseWheel (ev ){ Var ev = ev | event; // IE // WheelDelta rollback: Negative, rollback: Bottom // Alert (oEvent. wheelDelta ); // FF // Detail: roll down: positive, roll up: Negative // Alert (oEvent. detail) Var bDown = true; If (ev. wheelDelta ){ BDown = ev. wheelDelta <0; } Else { BDown = ev. detail> 0; } If (! BDown ){ If (checkFirst () return; ShowId --; } Else { If (checkLast () return; ShowId ++; } $ ("# Content"). attr ("showId", showId ); $ ("# Footer ul li "). children (). removeClass ("active "). end (). eq (showId ). children (). addClass ("active "); Center (showId ); If (oEvent. preventDefault ){ OEvent. preventDefault (); } Return false; } MyAddEvent (window, 'mousewheel ', onMouseWheel ); MyAddEvent (window, 'domainscroll', onMouseWheel ); }); |