I’m using http://imakewebthings.com/jquery-waypoints .
I want it to fire every time a div with id=”project” hits the top of the viewport. There is more than one div with this ID however it only works for the first div and none afterwards.
I’d really rather not use classes as it would confuse other areas of my code.
$('#project').waypoint(function() {
alert('Hello world');
});
Thanks 🙂
jQuery assumes that an id selector is unique and therefore only returns the first item it finds that matches.
So two possible solutions could be:
uniqueid-1,uniqueid-2,uniqueid-3, etc… Then use the attribute selector to match the substring in the id,$('[id^=uniqueid]')