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 -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -