3

I have a div class="container that I would like to add to <div class="second-menu-it"> if the screen size is less than 959px:

Below is the code i am trying to use:

$(window).on('resize', function() {
if($(window).width() < 959) {
    $('.second-menu-it').addClass('container');


})
3
  • you say less than and use > ?? I think it should be < Commented Dec 10, 2015 at 11:52
  • Sorry my bad..i typed it out wrong. even with < it doesnt work Commented Dec 10, 2015 at 11:54
  • jsfiddle.net/mohamedyousef1980/qfq80v8s Commented Dec 10, 2015 at 11:59

1 Answer 1

3

You forgot the } after the addClass

$(window).on('resize', function() {
    if($(window).width() < 959) {
        $('.second-menu-it').addClass('container');
    }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.