javascript - IE8 issue - Object doesn't support property or method error -
this problem..
code in -- cbpanimatedheader.min.js file
var cbpanimatedheader=(function(){var b=document.documentelement,g=document.queryselector(".cbp-af-header"),e=false,a=100;function f(){window.addeventlistener("scroll",function(h){if(!e){e=true;settimeout(d,250)}},false)}function d(){var h=c();if(h>=a){classie.add(g,"cbp-af-header-shrink")}else{classie.remove(g,"cbp-af-header-shrink")}e=false}function c(){return window.pageyoffset||b.scrolltop}f()})();
searched issue , found thread script438: object doesn't support property or method ie
"html element id has same id variable in javascript function"..
is solution.. mean.. have no idea.. can me out..
there several other issues too, quick found this:
window.addeventlistener("scroll",
where addeventlistener
not supported in ie8 , queryselector()
method partially supported. so, can either have fallback like:
var cbpanimatedheader = (function() { var b = document.documentelement, g = document.getelementsbyclassname("cbp-af-header")[0], e = false, = 100; function f() { window.onscroll = function(h) { if (!e) { e = true; settimeout(d, 250) } }; } function d() { var h = c(); if (h >= a) { classie.add(g, "cbp-af-header-shrink") } else { classie.remove(g, "cbp-af-header-shrink") } e = false } function c() { return window.pageyoffset || b.scrolltop } f() })();
Comments
Post a Comment