Disable Skrollr for mobile device ( <767px )

后端 未结 6 2068
暖寄归人
暖寄归人 2021-02-02 01:59

Firstly would like to thanks @prinzhorn for such an amazing and powerful library. My question: I have implemented a Skrollr parallax background to the header of my website but I

6条回答
  •  情歌与酒
    2021-02-02 02:42

    For me I wanted only some effects to be disabled on some mobile. I was using Bootstrap for responsiveness so some effects on desktop interfered when the columns collapsed on mobile.

    My solution was to make a custom class on the effects I didn't want to work on mobile. disable-mobile-skroll and then remove the data attributes I was using before skrollr was being initialized.

    if ($(window).width() < 768) {
        $('.disable-mobile-skroll').removeAttr('data-bottom-top').removeAttr('data-top');
    };
    // init Skrollr here
    

提交回复
热议问题