Smooth-Div-Scroll
Smooth-Div-Scroll copied to clipboard
hotSpots mouse position calculation
Hi :)
I have small sugestion. I had a problem with calculation mouse position over hotSpot on more complex site structure (paddings, margins, etc.)
this.offsetleft return offset to parent but e.pageX is window currsor position.
I changed:
var x = e.pageX - (this.offsetLeft + el.data("scrollerOffset").left);
to:
var x = e.pageX - $(this).offset().left;
for right scroll and:
var x = ((this.offsetLeft + el.data("scrollerOffset").left + el.data("hotSpotWidth")) - e.pageX);
to:
var x = e.pageX - $(this).offset().left;
// for left side change side |max speed ------ min speed|
x = -x + el.data("hotSpotWidth");
for left scroll.
Best regards, Mateusz