Learn free online HTML5, javascript, and jquery Tutorials by Examples

Wednesday, 14 December 2016

Removing a specific class when window is resized













NOTE:- There's no need to use addClass('') or removeClass('').

<div class="pane active">
    Content Here..
</div>

<style>
.active {
    color: red;
}
</style>

<script>
      $(window).on('load resize', function() {
           $(".pane").toggleClass("active", $(window).width() >= 600);
      });
</script>

No comments:

Post a Comment