I have created a script that enables the meta viewport tag on desktop. However I do not seem to be able to get the specified width from the viewport tag. I currently have this:
var viewportcontent = $( "#myviewport" ).attr('content');
var viewportcontents = viewportcontent.split(",");
//if it starts with 'width='
for (var i = 0; i < viewportcontents.length; i++) {
if(viewportcontents[i].lastIndexOf('width=', 0) === 0) {
var wspec = viewportcontent[i].substring(6);
}
}
The problem is that this seems ok, but does not work. Help! I have been looking at this for too long!
Website: http://apps.usecue.com/viewport/viewport_tag.html (static width, working)
Codepen: http://codepen.io/anon/pen/aZdMGa (dynamic width, not working)
Aucun commentaire:
Enregistrer un commentaire