javascript - jquery code working like media screen -
is there jquery code working @media (min-width:768px) {}
tried
$(window).one('resize',function () { if ($(window).width() < 800){ size = true; mob(); } }); $(window).trigger('resize');
this code works if click 1 time , re-size not work correctly. can 1 me. there jquery code working 100% @media (min-width:768px) {}
try using media query listener instead:
var mediamatch = window.matchmedia("(min-width: 768px)"); mediamatch.addlistener(handlemediachange); function handlemediachange = function (mediaquerylist) { if (mediaquerylist.matches) { // browser window @ least 768px wide } else { // browser window less 768px wide } }
this fire when width crosses 768px boundary.
Comments
Post a Comment