Skip to content

Instantly share code, notes, and snippets.

@theskillwithin
Last active October 30, 2015 20:27
Show Gist options
  • Save theskillwithin/6fb7652e82fb3cf7c46e to your computer and use it in GitHub Desktop.
Save theskillwithin/6fb7652e82fb3cf7c46e to your computer and use it in GitHub Desktop.
ysw team covers js
function checkOffset() {
var myElement = $( "#caption center" ).find('select').parents('center'),
test = myElement.offset().top - $(window).scrollTop();
if (test < 0) {
myElement.addClass('.stickytop');
} else {
myElement.removeClass('.stickytop');
}
}
}
if ($( "#caption center" ).length != 0) {
checkOffset();
$(window).resize(checkOffset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment