JQuery - Desplaza div usando la posición del cursor

Is there a way for scroll a div using the position of the cursor?

Demo made with JavaScript: http://scripterlative.com/files/cursordivscroll.htm

Gracias.

preguntado el 10 de marzo de 12 a las 16:03

scroll to the bottom of the link page you provided and you'll clearly see: "Download Instructions and Source Code" -

1 Respuestas

well if you will use jQuery plugin http://flesler.blogspot.com/2007/10/jqueryscrollto.html than everything is possible.

Don't know the actual effect you want to achieve, but if I'm imagining right, you probably want to do something like this for image preview slider at the bottom http://www.fredrikclement.com/#/series/selected/Redbull If yes, than just check mouse position when it is on that particular div. use something like that:

$('div').mousemove(function(e){
    var mouse_x = e.pageX,
        mouse_y = e.pageY;

    // here goes calculation code where you will decide how much to you want to
    // scroll the div, basically plugin works with target, so you might need to create
    // reference object with absolute position and change its position before you
    // you can scroll

});

respondido 10 mar '12, 17:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.