Pav*_*Pav 43
jQuery Waypoints插件http://imakewebthings.github.com/jquery-waypoints/应该可以解决问题
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Waypoints Plugin - Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="http://imakewebthings.github.com/jquery-waypoints/waypoints.min.js" type="text/javascript"></script>
<style type="text/css">
#mydiv {background-color:#FF0000; margin:1500px 0;}
</style>
</head>
<body>
<div id="mydiv">
Content goes here
</div>
<script type="text/javascript">
$(function() {
$('#mydiv').waypoint(function() {
window.location.href = 'http://google.com';
}, {
offset: '100%'
});
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Rob*_*itt 19
您可能还希望看到以下微小的插件,它在过去帮助我,它非常干净:
用法示例:
$('div').bind('inview', monitor);
function monitor(event, visible)
{
if(visible)
{
// element is now visible in the viewport
}
else
{
// element has gone out of the viewport
}
}
Run Code Online (Sandbox Code Playgroud)