Giter Club home page Giter Club logo

Comments (9)

littledu avatar littledu commented on September 13, 2024

在 onchange 方法里面可以知道 this.index 当前页面的索引,那么,this.index+1 就是下一页,this.index-1 就是上一页

from pageslider.

claire1028 avatar claire1028 commented on September 13, 2024

那在onbeforechange方法里面能知道即将滑动到的下一页的index吗?我希望能在滑动到某一页之前把某些元素给隐藏掉

from pageslider.

littledu avatar littledu commented on September 13, 2024

你的某一页肯定是固定的某一页对不对,那么,你可以在 onSwipeUp 和 onSwipeDown 方法里面判断:
假设某一页是 3

new PageSlider({
    pages: $('.page-wrap .page'),
    onSwipeUp: function(){
        if(this.index+1 === 3){
               //ooxx.style.display = 'none';
        }
   },
   onSwipeDown: function(){
        if(this.index-1 === 3){
               //ooxx.style.display = 'none';
        }
   }
});

from pageslider.

claire1028 avatar claire1028 commented on September 13, 2024

赞,非常感谢,请接受小白的膝盖

from pageslider.

claire1028 avatar claire1028 commented on September 13, 2024

还有个问题,如果这页内容很长的话,岂不是还没滑动到下一页,在向上滑动的时候就把某些元素给隐藏了?

from pageslider.

littledu avatar littledu commented on September 13, 2024

所以有一个长页面的需求

from pageslider.

claire1028 avatar claire1028 commented on September 13, 2024

"我希望能在滑动到某一页之前把某些元素给隐藏掉'",你给的建议是:
onSwipeUp: function(){
if(this.index+1 === 3){
//ooxx.style.display = 'none';
}
如果当前在index = 2的页面上,并且该页面是个长页面的话,岂不是向上滑动的时候,某些元素就隐藏了,如果我希望在跳转到另一页的时候才隐藏,在长页面向上滑动的时候不希望隐藏它,该怎么办呢?

from pageslider.

littledu avatar littledu commented on September 13, 2024

你再加一个判断不就行了?如果当前页是长页面,就不隐藏

from pageslider.

claire1028 avatar claire1028 commented on September 13, 2024

没太明白,那如何区分滑动的时候是当前页滑动还是跳到下一页的滑动呢?

from pageslider.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.