jQuery lags during slideDown/Up

956 views Asked by At

in the beginning I would to say that I've read bunch of tutorials and articles about it and nothing solves my problem. Responsive menu is lagging during the sliding down or up. It's the first time when it happens, all the time everything worked smooth and fine.

here the jQuery Code:

if ($(window).width() <= 820) {
    $('nav ul').addClass('mobile');
} else {
    $('nav ul').removeClass('mobile');
}
var hiddenContent = $( ".mobile" );
$( ".responsive" ).click(
    function( event ){
        event.preventDefault();
        if (hiddenContent.is( ":visible" )){
            hiddenContent.slideUp('fast');

        } else {
            hiddenContent.slideDown('fast');
        }
    }
);

I believe that jQuery is all right. The link to the wbsite http://kemizo.pl/en/index I've tried different jQuery scripts and fixed width to ul and li elements. It just doesn't work.

2

There are 2 answers

2
Kasynych On

Try to use CSS3 animation, or existing menu jQuery plugins

0
Tahir Ahmed On

I think your style nav * { transition:all 0.3s; } in line 238 of styles.css interferes with jQuery's slideDown() (or whatever animation method) you are using. Disable it temporarily to see if the animation runs smoothly.