I have a script that works fine in everything but IE8/9. The weird thing is, when I open the developer tools and console in IE to deb, and then refresh the page as it says to, the script runs fine. What am I missing? Any idea what IE doesn't like about this script?
One other note - the script doesn't load until the window loads as I need to measure the height of images, so maybe that is part of the problem?
Thanks for any help
$(window).load(function(){
function offsetElement(element, container){
if ( $(window).width() > 767 ) {
$(element).each(function(index,value){
var snapImage = $(this),
snapImageHeight = snapImage.height(),
containerHeight = snapImage.closest(container).outerHeight(),
topOffset = (containerHeight - snapImageHeight) / 2;
$(this).css({ 'top' : topOffset });
});
}
}
offsetElement('.snapshot', '.event');
offsetElement('.dot', '.event');
function activeSnap(){ return offsetElement('.snapshot', '.event'); }
function activeDot(){ return offsetElement('.dot', '.event'); }
$(window).resize(function(){
activeSnap();
activeDot();
});
});