1

I'm looking for a solution to animate a horizontal gallery (div) based on cursor's proximity to the left or right of the window. The center of the window will do nothing, but as you begin to creep left, the gallery slides right, and visa versa. Very common thing to do, but I want to accomplish this with javascript/jquery. If someone could just get me on the right track I would appreciate it.

2 Answers2

2

(Edit) For a newer and improved example go to this SO question:
Horizontal scroll on mouseMove - wide div in smaller div with overflow:hidden (Can't get the math to work)


I created a mousemove gallery. Hope this will help.

JSFIDDLE DEMO: MOUSEMOVE GALLERY

Just set into the css the desired width and height of the gallery container.
Fill the gallery with images and enjoy! :)
The code is simplyfied and commented to help anyone upgrade it.

Community
  • 1
  • 1
Roko C. Buljan
  • 196,159
  • 39
  • 305
  • 313
  • @Ludovic Thanks. Please follow this one: http://stackoverflow.com/questions/16050564/horizontal-scroll-on-mousemove-wide-div-in-smaller-div-with-overflowhidden-c – Roko C. Buljan Oct 15 '13 at 14:06