Jump to content
Search Community

LukeWilson

Members
  • Posts

    4
  • Joined

  • Last visited

LukeWilson's Achievements

0

Reputation

  1. Wow, I really got to pay more attention to using the correct syntax because I just copied and pasted your "good" version and it does work As a beginner it seems like a lot of my problems are due to bad syntax... it's all those {} and () and of course }); I'll get better in time and stop pestering people for simple things! Thanks hombre
  2. Why doesn't 'myFunction()' fire at the end of this? (simple scroll-to-section) $('a.trigger').bind('click',function(event){ event.preventDefault(); var $anchor = $(this); var scrollY = $($anchor.attr('href')).offset().top - 100; TweenLite.to($(window), 1.6, {scrollTo:{ y:scrollY, onComplete:myFunction, ease:Power2.easeInOut }}); function myFunction(){ alert('done'); } }); Something to do with the scrollTo plugin??? I am confused...I have tried putting onComplete outside of the scrollTo:{} brackets, still nothing... what's up? Thank you very much for any help! Luke
  3. Hi Thanks for your reply Upon firing it up this morning I found out that it actually works as expected?!? No jump from 0 or nothing.. Now I am gonna have to find out what was causing it to behave like that... Thanks again
  4. Hi everyone I am implementing a simple smooth scrolling to next section type of thing. Here is the code: $('a.next-section').click(function(){ scrollTop = $(window).scrollTop(); $('h1').each(function(i, h1){ // loop through article headings h1top = $(h1).offset().top; // get article heading top if (scrollTop<h1top) { // compare if document is below heading TweenLite.to(window, 0.5, {scrollTo:{y:h1top}, ease:Power2.easeOut}); return false; // exit function } }); }); As it is, it scrolls to the next section, but starts from the TOP of the page most of the time - obviously I want it to scroll from the current window position to avoid the nasty 'massive jump' effect. I have tried: TweenLite.fromTo(window, 0.5, {y:window.y}, {scrollTo:{y:h1top}, ease:Power2.easeOut}); where 'window.y' is the current Y position of window (correct??) I have also tried for the "from" part: {y:$(window).scrollTop()} (or the "scrollTop" variable which is the same thing) It does the same thing... what am I missing? It seems pretty simple... Can anybody help me? Thanks a lot (I'm learning)!
×
×
  • Create New...