如何让我的网站在Chrome上向下滚动?

时间:2018-01-17 01:17:15

标签: javascript jquery html css wordpress

我需要我的WordPress网站在Chrome上向下滚动(它在其他浏览器上滚动得很好),每个滚动的部分适合屏幕的宽度和高度。

以下是我使用的代码:



jQuery(document).ready(function() {
  var win_width = jQuery(window).width();
  if (win_width <= 1300 || win_width > 1600) {
    jQuery('#fw_c').fullpage({
      anchors: ['firstPage', 'secondPage', '3rdpage', '4thpage', 'lastPage'],
      afterLoad: function(anchorLink, index) {
        if (index == 1) {
          jQuery(".section.def_section,#header_container").removeClass('custom-shrink');
          jQuery("#section0 .rda_zoomIn").addClass("animated zoomIn");
        } else {
          jQuery(".section.def_section,#header_container").addClass('custom-shrink');
        }
        if (index == 2) {
          jQuery(".section2-title .rda_fadeInDown").addClass("animated fadeInDown");
          jQuery(".section2-body .rda_fadeInLeft").addClass("animated fadeInLeft");
        }
        if (index == 3) {
          jQuery(".section3-title .rda_fadeInDown").addClass("animated fadeInDown");
          jQuery(".section3-body .rda_fadeInLeft").addClass("animated fadeInLeft");
          jQuery(".section3-body .rda_zoomIn").addClass("animated zoomIn");
        }
        if (index == 4) {
          jQuery(".section4-title .rda_fadeInDown").addClass("animated fadeInDown");
          jQuery(".section4-body .rda_fadeInLeft").addClass("animated fadeInLeft");
          jQuery(".section3-body .rda_zoomIn").addClass("animated zoomIn");
        }
        if (index == 5) {
          jQuery(".section5-title .rda_fadeInDown").addClass("animated fadeInDown");
          jQuery(".section5-body .rda_fadeInLeft").addClass("animated fadeInLeft");
          jQuery(".section3-body .rda_zoomIn").addClass("animated zoomIn");
        }
      },
    });
  }
});
&#13;
<link rel="stylesheet" type="text/css" href="https://bluestonepools.com.au/wp-content/themes/thefox/custom_bgi/jquery.fullPage.css" />
<script type="text/javascript" src="https://bluestonepools.com.au/wp-content/themes/thefox/custom_bgi/jquery.fullPage.js"></script>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

我刚编辑了SmoothScroll.js文件

/ *****************平滑滚动****************** / if(navigator.platform.toUpperCase( ).indexOf('MAC')=== -1&amp;&amp;!navigator.userAgent.match(/(Android | iPod | iPhone | iPad | IEMobile | Opera Mini)/)){ !function(){function e(){var e =!1; e&amp;&amp; c(“keydown”,r),v.keyboardSupport&amp;&amp;!e&amp; u(“keydown”,r)}函数t(){if(document.body){var t = document.body,n = document.documentElement,o = window.innerHeight,r = t.scrollHeight; if(S = document.compatMode.indexOf(“CSS”)) &gt; = 0?n:t,w = t,e(),x =!0,top!= self)y =!0;否则if(r&gt; o&amp;&amp;(t.offsetHeight&lt; = o || n.offsetHeight&lt; = o)){var a =!1,i = function(){a || n.scrollHeight == document.height ||(a =!0,setTimeout(function(){n.style。 height = document.height +“px”,a =!1},500))}; if(n.style.height =“auto”,setTimeout(i,10),S.offsetHeight&lt; = o){var l =使用document.createElement( “DIV”); l.style.clear = “两者”,t.appendChild(1)}} v.fixedBackground || b ||(t.style.backgroundAttachment = “滚动”,n.style。 backgroundAttachment =“scroll”)}}函数n(e,t,n,o){if(o ||(o = 1e3),d(t,n),1!= v.accelerationMax){var r = + new Date,a = rC; if(a1&amp;&amp;(i = Math.min(i,v.accelerationMax),t * = i,n * = i)} C = + new Date} if(M.push( {x:t,y:n,lastX:0&gt; t?.99: - 。99,lastY:0&gt; n?.99: - .99,start:+ new Date}),! T){var l = e === document.body,u = function(){for(var r = + new Date,a = 0,i = 0,c = 0; c = v.animationTime,h = f?1:d / v .animationTime; v.pulseAlgorithm&amp;&amp;(h = p(h)); var m = sx hs.lastX&gt;&gt; 0,w = sy hs.lastY&gt;&gt; 0; a + = M,I + =瓦特,s.lastX + = M,s.lastY + = W,F&安培;及(M.splice(C,1),C - )}升window.scrollBy(A,I):( A和? ;及(e.scrollLeft + = a)中,I和及(e.scrollTop + = 1)),T || ||ñ(M = []),M.length N(U,E,O / v的? .frameRate + 1):T =!1}; N(u,e,0),T =!0}}函数o(e){x || t(); var o = e.target,r = l (○);若(R || || e.defaultPrevented S(瓦特, “嵌入”)|| -S(O, “嵌入”)及!&安培; / PDF / i.test(o.src)) return!0; var a = e.wheelDeltaX || 0,i = e.wheelDeltaY || 0;返回|| i ||(i = e.wheelDelta || 0),! v.touchpadSupport&amp;&amp; f( ⅰ)?0:(Math.abs(一)及GT; 1.2&安培;及(A * = v.stepSize / 120),Math.abs(I)GT; 1.2&安培;&安培;(I * = v。 stepSize / 120),n(r,-a,-i),void e.preventDefault())} function r(e){var t = e.target,o = e.ctrlKey || e.altKey || e .metaKey || e.shiftKey和放大器;&安培; e.keyCode == H.spacebar;!如果(/input|textarea|select|embed/i.test(t.nodeName)|| t.isContentEditable || e.defaultPrevented | | O)返回0! ; if(s(t,“button”)&amp;&amp; e.keyCode === H.spacebar)return!0; var r,a = 0,i = 0,u = l(w),c = u .clientHeight; switch(u == document.body&amp;&amp;(c = window.innerHeight),e.keyCode){case H.up:i = -v.arrowScroll; break; case H.down:i = v。 arrowScroll; break; case H.spacebar:r = e.shiftKey?1:-1,i = -r c .9; break; case H.pageup:i = .9 * -c; break; case H.pagedown:i = .9 * c; break; case H.home:i = -u.scrollTop; break; case H.end:var d = u.scrollHeight-u.scrollTop-c; i = d> 0?d + 10:0; break; case H.left:a = -v.arrowScroll; break; case H.right:a = v.arrowScroll; break; default:return!0} n(u,a ,i),e.preventDefault()}函数a(e){w = e.target}函数i(e,t){for(var n = e.length; n - ;)E [A(e [ n])] = t;返回t}函数l(e){var t = [],n = S.scrollHeight; do {var o = E [A(e)]; if(o)return i(t, ○);若(t.push(E)中,n === e.scrollHeight){如果(Y || S.clientHeight + 100 1:-1,T = T大于0 1:!?-1,( kx!== e || ky!== t)&amp;&amp;(kx = e,ky = t,M = [],C = 0)}函数f(e){if(e){e = Math .abs(e),D.push(e),D.shift(),clearTimeout(z); var t = h(D [0],120)&amp;&amp; h(D [1],120)&amp; ;&安培; H(d [2],120);!返回吨}}函数的nh(e,t){return Math.floor(e / t)== e / t} function m(e){var t,n,o; return e * = v.pulseScale,1&gt; e?t = e - (1-Math.exp(-e)):( N = Math.exp(-1),E = 1,o是1-Math.exp(-e),T = N + O *(1- n)),t * v.pulseNormalize}函数p(e){return e&gt; = 1?1:0&gt; = e?0:(1 == v.pulseNormalize&amp;&amp;(v.pulseNormalize / = m(1) )),m(e))} var w,g = {frameRate:150,animationTime:400,stepSize:120,pulseAlgorithm:!0,pulseScale:8,pulseNormalize:1,accelerationDelta:20,accelerationMax:1,keyboardSupport: !0,arrowScroll:50,touchpadSupport:0,fixedBackground:0,排除:! “”},v = G,b = 1,Y = 1,K = {X:0,Y:0},X != 1,S = document.documentElement中,d = [120120120],H = {左:37,高达38,右:39,下:40,空格键32,上页:33,下页:34,端:35 ,home:36},v = g,M = [],T =!1,C = + new Date,E = {}; setInterval(function(){E = {}},1e4); var z,A = function(){var e = 0; return function(t){return t.uniqueID ||(t.uniqueID = e ++)}}(),N = function(){return window.requestAnimationFrame || window.webkitRequestAnimationFrame | |功能(例如,T,N){window.setTimeout(E,N || 1E3 / 60)}}(),K = /铬/ i.test(window.navigator.userAgent) ,L = null; document.createElement(“div”)中的“onwheel”?l =“wheel”:document.createElement(“div”)中的“onmousewheel”&amp;&amp;(L =“mousewheel”),L&amp; &安培; K&安培;及(U(L,O)中,u( “鼠标按下”,一)中,u( “负载”,T))}();}