My problem is the following, I'm using the scrollTo
plugin, everything was ok, working on all the elements I wanted on the site.
But they asked to change something in the menu, currently the effect only happens when I click on the <a href="#">
tag, but they asked to change, now everything has to happen when I click on <li>
. Ok it could involve li
within a
, but I would have a bigger work (I believe) than change in JS
, but not to achieve, I already modified the code below a few times and only worked when in% I've put html
in the href
tag (but that should be wrong right).
Follow the code.
$(function(){
var wrapper = $("#wrapper"),
$menu = $("#menu");
$menu.on("click","a", function(){
var $this = $(this),
href = $(this).attr("href"),
topY = $(href).offset().top;
TweenLite.to(window, 2, {scrollTo:{y:topY, x:0}, ease:Cubic.easeIn});
return false;
});
});
nav#menu.menu
ul
li.icon-play
a(href="#home")
li.link-empresa
a(href="#empresa") playlearn
li.link-tecnologias
a(href="#tecnologicas") tecnologia educacional
li.link-cases
a(href="#cases") portifólio
li.link-contato
a(href="#contato") contato