问题
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