javascript - Different design desktop/mobile devices -
i hope there answer question. i'm not @ codeing , hope understand question.
is there way have 2 different designs.. have design desktop/ipad , 1 mobile devices. 1 mobile device more design of application. want if javascript code find out website opened on mobile device, website turn version mobile device.
for example: desktop/ipad version index.html , mobile version mobile.html
is there way make javascript code go mobile version if
if(!is_mobile) { (function(xxxxx) { xxxxxx }
the following javascript code useful:
function adjuststyle(){ var width = 0; //getting width of webpage if(window.innerheight){ width = window.innerwidth }else if(document.documentelement && document.documentelement.clientheight){ width = document.documentelement.clientwidth; }else if(document.body){ width = document.body.clientwidth; } //loading css if width less 600. make sure link tag has id "mycss" if(width < 600) { document.getelementbyid("mycss").setattribute("href","css/mobile.css") }else{ document.getelementbyid("mycss").setattribute("href","css/desktop.css") } } //calling function window.onresize = function(){ adjuststyle(); }
Comments
Post a Comment