javascript - Get meta viewport tag to work on desktop -
i have created script enables meta viewport tag on desktop. not seem able specified width viewport tag. have this:
var viewportcontent = $( "#myviewport" ).attr('content'); var viewportcontents = viewportcontent.split(","); //if starts 'width=' (var = 0; < viewportcontents.length; i++) { if(viewportcontents[i].lastindexof('width=', 0) === 0) { var wspec = viewportcontent[i].substring(6); } }
the problem seems ok, not work. help! have been looking @ long!
website: http://apps.usecue.com/viewport/viewport_tag.html (static width, working)
codepen: http://codepen.io/anon/pen/azdmga (dynamic width, not working)
sorry guys... turned out typo! var wspec = viewportcontent[i].substring(6);
had var wspec = viewportcontents[i].substring(6);
. have remember use better variable names!!!
working version here: http://codepen.io/anon/pen/gqoeyj
Comments
Post a Comment