Waypoint not working on overflow:hidden;

我只是一个虾纸丫 提交于 2019-12-13 01:24:24

问题


Fiddle

If you remove overflow property from .wrapper in fiddle, waypoints will work fine.
But not with overflow hidden in x or y

Here is the code:

HTML:

<div class="wrapper">
    <div id="sec1" class="section">dfa fdasfsdafd as</div>
    <div id="sec2" class="section">dfa fdasfsdafd as</div>
    <div id="sec3" class="section">dfa fdasfsdafd as</div>
    <div id="sec4" class="section">dfa fdasfsdafd as</div>
</div>

CSS:

html, body, .wrapper, .section{
    height:100%;
}
.wrapper{
    overflow-x: hidden;
    overflow-y: auto;
}

JS:

$('#sec3').waypoint(function(direction) {
    $('#sec3').css({
        backgroundColor: "#f99"
    });
});

Any jQuery or css solution?


回答1:


UPDATED 2014-05-16

Add a waypoint() function binded to the <div> id to make the css changes appear.

The context of the waypoint() should be your outer div <div class="wrapper">:

DEMO



来源:https://stackoverflow.com/questions/23563016/waypoint-not-working-on-overflowhidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!