-2
I have the following structure:
<body>
<div id="topo">
<section class="topo">
<div>
<ul id="menuTopo">
<li><a href='#alvo'>Link</a></li>
...
I even put the div
on a var
var topo = $('body div#topo section.topo div');
So then I did the following:
$(topo).find('ul#menuTopo li a[href^="#"]').click(function () {
alert();
e.preventDefault();
var id = $(topo).find('ul#menuTopo li a').attr('href'),
targetOffset = $(id).offset().top;
$('html, body').animate({
scrollTop: targetOffset - 100
}, 500);
});
and the return I had was that the effect does not occur! Nor the alert
works
But the ul is there.
If I do:
$(topo).find('ul#menuTopo li a').click(function () {
alert();
The alert
works!
Where am I going wrong?
I need to do a sliding effect on links#
menu
How would that "sliding effect"?
– Sumback
And why not just use the dial
a[href^="#"]
?– iamdlm
Sumback, is an effect that instead of clicking the loink goes down as a flash to the target #, it goes down smooth...
– Carlos Rocha
iamdim: by the fact that I only want this effect ul only of links and not on the whole site
– Carlos Rocha