Gallex
Gallex

Reputation: 321

jquery: execute function since screen resolution 650px width

Execute this function below only when the screen resolution is at least 650px wide. Otherwise, do nothing.

$('.section-box').waypoint(function() {
    $(this).addClass('animated-107s bounceDown');
}, {
    offset: '25%'
});

Could you help me?

Upvotes: 0

Views: 761

Answers (1)

Gurkan Yesilyurt
Gurkan Yesilyurt

Reputation: 2675

You can try it.

<div class=".section-box" id="myClass">

JS

//control first open browser
  $(document).ready(function () {
    if( $( window ).width() <= 650 ){

          $("#myClass").addClass("bounceDown");


    } 
  });

  //change browser size
  $( window ).resize(function() {

    if( $( window ).width() <= 650 ){
          $("#myClass").addClass("bounceDown");
    } else {
       $("#myClass").removeClass("bounceDown");
    }
  });

Upvotes: 1

Related Questions