[英]Parallax scrolling with custom scroll bar
我在插件 (pixelcog parallax.js) 上使用視差滾動,它在默認瀏覽器滾動條上運行良好,但我在我的網站上使用自定義滾動條插件,但視差沒有運行。 我嘗試了以下代碼。
網址:
<body>
<section class="hobies-wrapper" data-parallax="scroll" data-image-src="images/parallax-img2.png"></section>
</body>
Javascript:
function myCustomFn(el){
$('.hobies-wrapper').parallax({imageSrc: 'images/parallax-img2.png'});
};
$(document).ready(function ()
{
$("body").mCustomScrollbar({
theme:"minimal",
mouseWheel:{ enable: true },
keyboard:{ enable: true },
mouseWheel:{ invert: true },
documentTouchScroll: true,
scrollEasing:"easeInOut",
scrollButtons:{
enable:true
},
callbacks:{
onScroll:function(){
myCustomFn(this);
}
}
});
});
parallax.js只檢測窗口滾動而不是任何自定義滾動條。
parallax.js 不是必需的。 根據此頁面嘗試通過CSS創建“視差”滾動效果
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.