简体   繁体   中英

jQuery OnMouseMove scroll div Top/Bottom, NOT right/left, how?

please how to change this code? http://jsbin.com/alokat/1/edit I need scroll Up and Down, not Left and Right. Thanks for reply.

I have adjusted your code a little:

    galW   = $gal.outerWidth(true),
    galSW  = $gal[0].scrollWidth,

to

    galW   = $gal.outerHeight(true),
    galSW  = $gal[0].scrollHeight,

and changed the offset for the mousemove .

Also you need to change $gal.scrollLeft(posX*wDiff); in setInterval to $gal.scrollTop(posX*wDiff); .

You can see all chnages here: http://jsbin.com/alokat/102/

This works http://jsbin.com/alokat/109/edit . Should rename the variables and methods though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM