slicknav item function don't work

626 Views Asked by At

hi im using slicknav in my project and i don't know why when i add a function to a menu item it do nothing !! need some help :) thx

HTML

<ul id="menu">
    <li ><a class="link1" href="">Accueil</a>  </li>
    <li ><a class="link2" href="">Services</a>  </li>
    <li ><a class="link3" href="">Références</a>  </li>
    <li ><a class="link4" href="">Groupe</a>  </li>
    <li ><a class="link5" href="">Contact</a>  </li>
</ul>

JS

$('.link1').click(function(){
    $('html, body').animate({
        scrollTop:0
    }, 1500, function() {
        parallaxScroll(); // Callback is required for iOS
    });
    return false;
});
1

There are 1 best solutions below

0
On

Your code is working just fine as you can see here

I suggest you use delegated events like this:

var b = $('body');
$('.link1', b).click(function(){ ... });

This way all elements you create with the "link1" class in the "body" will listen to that click event.

Be also sure to check for errors in that "parallaxScroll" function.