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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -