C
C
Cal_Lightman2021-01-26 17:07:45
JavaScript
Cal_Lightman, 2021-01-26 17:07:45

Now the script is working through JQuery, how will it look like in pure JS?

Tell me, knowledgeable people, how will the script on pure JS look right?
And that both old and new browsers support it.

function resizeScrenn(){
if ($(window).width() <= 991){

}
else{

}
}
resizeScrenn();
$(window).resize(function(){
  resizeScrenn();
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Loli E1ON, 2021-01-26
@Cal_Lightman

function resizeScreen() {
  if (window.innerWidth <= 991){
    console.log(window.innerWidth);
  }
  else {
    console.log();
  }
}

resizeScreen();
window.addEventListener('resize', resizeScreen);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question