Hi Alexandre,

Jonathan Sharp created a plugin that doesn't something very similar to what you're going for here. Maybe you can grab some ideas for it?

http://jdsharp.us/jQuery/plugins/AutoScroll/


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Oct 17, 2007, at 12:59 PM, Alexandre Plennevaux wrote:


Hi friends,

i was wondering: how can i trigger an action while the mouse stays on a specific area of the screen?

i tried the following code: it works ONCE (when the mouseover event is triggered) but not continuously, while the mouse i over my "active" zone.

var centerX = $('#datascape').width()/2;
stepX = 240;
var $datascapeViewport = $('#ds-viewport');
$datascapeViewport.css({position: 'relative',left: 0+'px'})
.bind('mouseover',function(e){
        var minX = $(this).width();
        minX=-minX;
        var maxX = 0;
        var newLeft = 0;
        var Position = $(this).offset();
        if (e.pageX >= centerX) {
                newLeft = Position.left-stepX;
        } else
        {
                newLeft = parseInt(Position.left) + stepX;
        }
//alert("\nposition.left="+Position.left +"\nnewLeft="+newLeft +"\nstepX="+stepX);
        newLeft = -newLeft;
        if ((newLeft<maxX) && (newLeft>minX)) {
        $(this).animate({left: newLeft+'px'},1000);
        }
});

just for background, i'm trying to have a very wide image scroll horizontally according to the mouse position on the X axis, center being no scroll, left position meaning scroll image right, and invertedly.


Thanks for your insight!

Alexandre

Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.488 / Base de données virus: 269.14.13/1074 - Date: 16/10/2007 14:14



Reply via email to