Mobile browser to the header sometimes with position:fixed, useless, can only be used Position:absolute, instead, in view of this, encapsulated the following code with adapter specific and filtering:
functionissupportfixed () {varUserAgent =Window.navigator.userAgent, iOS= Useragent.match (/(Ipad|iphone|ipod) \s+os\s ([\d_\.] +)/), Ios5below= iOS && ios[2] && (parseint (Ios[2].replace (/_/g, '. '), ten) < 5), Operamini=/opera mini/i.test (useragent), Body=document.body, Div, isfixed; Div= document.createelement (' div '); Div.style.cssText= ' display:none;position:fixed;z-index:100; '; Body.appendchild (DIV); Isfixed= window.getComputedStyle (div). Position! = ' fixed '; Body.removechild (DIV); Div=NULL; return!! (isfixed | | ios5below | |operamini);}
201508061040_ Mobile Development--solving the problem code of header location difference