Jump to content
Search Community

raffademello

Members
  • Posts

    1
  • Joined

  • Last visited

raffademello's Achievements

0

Reputation

  1. Good Morning Guys; I want to scroll the current article when I click to the next or prev link, but on console browser shows the following information : invalid scrollTo tween value: [object Object] The HTML Structure is : <div class="mask-articles"> <article class="history-article-1"> </article> <article class="history-article-2"> </article> <article class="history-article-3"> </article> </div> and the JS /* Time Line Quem Somos*/ var section = 0; var sectionTotal = $(".mask-articles > article").length - 1; var article = $(".mask-articles > article"); console.log($(section)); $(".prev-history").click(function (e) { e.preventDefault(); if (section > 0) { section--; } TweenMax.to($(".mask-articles"),0.5,{scrollTo:{y:$(".history-article-"+section).offset.top}}); }) $(".next-history").click(function (e) { e.preventDefault(); if (section < sectionTotal) { section++; } TweenMax.to($(".mask-articles"),0.5,{scrollTo:{y:$(".history-article-"+section).offset.top}}); //TweenMax.to(window, 0.5, {scrollTo:{y:$("#div" + section).offset().top}}); }) Somebody can help me ? Thank you.
×
×
  • Create New...