jQuery - function for screen size with window.innerWidth

0 votes
135 views
added Aug 15, 2019 in jQuery by lcjr First Warrant Officer (9,190 points)
function lcPagination() {
  var wDevice = window.innerWidth;
  if (wDevice > 767) {
    $('div#pageDesk').css('display','block');
    $('div#pageMob').hide();
  } else {
    $('div#pageMob').css('display','block');
    $('div#pageDesk').hide();
  }
}

$(document).ready(function() {
  lcPagination();
});

$(window).on('load resize', function() {
  lcPagination();
});

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...