Im using the jQuery waypoints plugin. This following is working fine except on page load the console message is fired before ive scrolled. This stops If I remove the display block being applied to the images, but I need this for my site to work.
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="js/jquery-2.0.3.js"></script>
<script src="js/waypoints.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
img {
max-width: 100%;
display: block;
margin: auto;
}
#img3 {
opacity: 0.5;
}
</style>
<script>
$(document).ready(function() {
$('#img3').waypoint(function() {
console.log('Basic example callback triggered.');
});
});
</script>
<body>
<img src="images/1.jpg" alt="image 1" id="img1">
<img src="images/2.jpg" alt="image 2" id="img2">
<img src="images/3.jpg" alt="image 3" id="img3">
<img src="images/4.jpg" alt="image 4" id="img4">
</body>
</html>