My idea is of triggering this border-bottom transition animation on my h2 element when it appears in the viewport.
Now, I made it work in JSFiddle, with jQuery 1.7.2, but for whatever reason it doesn't work in the newest jQuery.
Here is the working jsfiddle:
$(document).ready(function(){
$('.underline').bind('inview', function (event, visible) {
if (visible == true) {
// element is now visible in the viewport
$(this).addClass('full');
console.log( "added ");
} else {
// element has gone out of viewport
$(this).removeClass('full');
console.log( "removed ");
}
});
});
And here is the not working one on codepen and jsfiddle:
Any idea why it's not working ?
Aucun commentaire:
Enregistrer un commentaire