Eduardo Hernandez
Eduardo Hernandez

Reputation: 619

Window resize at certain size

I am trying to write a JQuery function, so when I resize a window at 700px, I can remove a CSS class.

Is there any way I could do that?

Could someone point me to some resources or give me and example?

Upvotes: 0

Views: 74

Answers (2)

Godinall
Godinall

Reputation: 2290

Using two sets of CSS and use media query to listen to screen width might be easier and better. And gives you more control of style on smaller browser sizes and better result.

Upvotes: 0

Scary Wombat
Scary Wombat

Reputation: 44813

1) Listen for resize event see http://api.jquery.com/resize/

E.g

 $( window ).resize(function() {
  $( "body" ).prepend( "<div>" + $( window ).width() + "</div>" );
});

2) Remove class see http://api.jquery.com/removeClass/

E.g

$( "p" ).removeClass( "myClass yourClass" )

Upvotes: 1

Related Questions