Smooth-Div-Scroll icon indicating copy to clipboard operation
Smooth-Div-Scroll copied to clipboard

hotSpots mouse position calculation

Open Karql opened this issue 12 years ago • 0 comments

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

Karql avatar Nov 14 '13 12:11 Karql