Jump to content
Search Community

donum

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by donum

  1. Hi,

     

    thank you for the quick reply!

     

    @Jonathan

     

    Thanks for fixing. I fixed it, too, but it seems like jsfiddle didn't save it. I'm not familiar with the tool so it was my mistake.

     
    I updated the jsfiddle so that the demo works.

     

    I see what's happening - the ScrollToPlugin automatically tries to deliver the most intuitive behavior by killing the tween if something else intervenes and edits the scroll position mid-tween. So, for example, let's say that you tween the scroll position all the way down the page over 3 seconds, but 1 second into that tween, the user flicks their scroll wheel or drags the scroll bar manually - it could get really annoying if the tween insists on going where you told it to go instead of honoring the user's interaction. If I were the user, I'd be ticked. 

     

    100% agree. I really want to avoid this behavior (btw. jquery.scrollTo acts like that). I remember the moment when I realized your great API doesn't do it. autoKill:false will enable this behavior again so I will just wait for the next update. :-)

     

     

    The situation you ran into was that you were telling it to scroll beyond the maximum possible scroll position, and the plugin was trying to honor that, but when the browser it the max, it just refused to go anywhere and the plugin was like "dude, I told you to go to ____ and it's not there, so I better kill this tween". I'll add some code on the next update of the engine so that it specifically looks for this condition and doesn't kill the tween. 

     

    Absolutely! Exactly what I had in mind. Thank you very much! *Edit* Awesome to now understand why it behaves like it does. There's a very good reason for it to do so. Would be great if you could add this edge-case though, because it's not unlikely to run into it.

     

    You both have a good weekend!
     
    Edit: Just opened a Ticket on github:
    https://github.com/greensock/GreenSock-JS/issues/28
     
    Hope that makes things easier/more organized.
     
    Cheers,
    Daniel
    • Like 1
  2. Hi Jonathan,

     

    thanks for your reply.

     

    what about putting your onComplete callback inside the scrollTo object {} like Jack suggested above.

     

    As far as I understand Jack suggested the exact opposite to LukeWilson. The scrollTo plugin seem to not have a onComplete method.

     

    I created a testcase on jsfiddle.

     

    *jsfiddle updated*:

    http://fiddle.jshell.net/4UcfT/10/

    http://fiddle.jshell.net/4UcfT/10/show/

     

    If you click on Headline 1, it will scrollTo Headline1 and fire the onComplete event. If you click on Headline 2, it will go as far as it can to that headline, but it won't reach the exact position and therefore won't fire the onComplete event.

     

    For me this seems like a bug in scrollTo. If scrollTo reaches the end of the browser window, it's obvious that the whole job is done, isn't it? Maybe I'm missing something. :)

     

    Thanks,

    Daniel

  3. Hi,

     

    first of all, thank you very much for this awesome piece of software. It's a pleasure to use!  :)

     

    I have the same problem so I just use this thread. I'm using scrollTo to go to the bottom of the page and I have a status variable "going_to_anchor" which prevents other parts of my app from interacting while the scrollTo animation happens.

     

    However, the onComplete event doesn't get fired. I think the problem might be that the scrollTo can't scroll to the target element since it's the end of the page and the scrolling stops before the script has reached the target element. I would think the script would understand what just happened and just fires the onComplete event.

     

    Here's , my code:

    var going_to_anchor=false;
    
    $("a#myanchor").click(function(e){
    	e.preventDefault;
    	going_to_anchor=true;
    	TweenLite.to(window, 0.75, {scrollTo:{y:$("#contact_form").offset().top},
    		onComplete:function(){
    			console.log("complete");
    			going_to_anchor=false;
    		}
    	});
    	$(this).fadeOut();
    	return false;
    }
    

    When I change the target element from #contact_form to another element (which is higher up the page) then it works. So I think this is a bug.

     

    What do you think?

     

    Thank you!
    Daniel

×
×
  • Create New...