Smooth-Div-Scroll
Smooth-Div-Scroll copied to clipboard
Callbacks inside wrong test loop
Hi Great script here.
I couldn't get any callback to work (except setupComplete). neither scrolledToLastElement nor scrollerRightLimitReached... even with a simple console.log test function.
I stuck my nose into your code and realised that triggered callbacks were made inside a test about hot spot visibility. I believe it should rather be triggered in your move function...
Anyway, I worked it out when I set hotSpotScrolling to true.
Thanks !!
Could you post your code? I think I can understand the problem better if I can see your setup. If you are using autoscrolling to scroll the content, there are different callbacks for when the left or right limit has been reached.
http://www.smoothdivscroll.com/callbacks.html#autoScrollingLeftLimitReached http://www.smoothdivscroll.com/callbacks.html#autoScrollingRightLimitReached
But I guess that wasn't the problem in this case?
Indeed, I don't use autoscroll. The main callback I needed was scrollerRightLimitReached, triggered by mouse wheel or touch slide. If I set the option : $("#makeMeScrollable").SmoothDivScroll({ hotSpotScrolling: false });
the callback scrollerRightLimitReached is ignored :
$("#makeMeScrollable").SmoothDivScroll({ hotSpotScrolling: false, scrollerRightLimitReached : function() { console.log("right end is reached"); } });
In your code, this callback is triggered in a loop concerning hotspot. :)
Ah! I see. This is because mousewheel and touch scrolling has been added on much later and I haven't updated the callbacks. I'll look into this!
And if you move your callback, it would be nice to implement a scrollerRightLimitSoon : almost the same, but triggered before the end is reached. It will allow to refill the content before the user realise it, and make the scroll look infinite. :) Thanks !
That callback could also be used for lazyload implementation could it not?
if by lazyload you mean loading just before it's necessary, that's my point ;)
This is a new feature and I understand that it could be very useful. I will add these two items to my list of requested features:
- Make the plugin trigger scrollerRightLimitReached/scrollerLeftLimitReached with mousewheel and touch scrolling as well (bugfix).
- Add new callbacks that is triggered when the scroller reaches a certain point (preferably user defined in pixels) before the left or right end of the scroller (new feature).
Well, I made my first fork (I hope I did it properly) for the callback before the end is reached. You can see the reasult plugged into a drupal here : http://circulart.fr/liste-des-artistes :)
Yes, your fork looks good! The only problem is that I have a working copy of the code that is not published here on GitHub (yet) and there are many other changes in that. So I will probably not merge but nevertheless it was great to see your implementation and I think I will use it!
Apparently callbacks still aren't working in the current version... Any plans on fixing them?