Yeah. There is some personal tastes too, like do you want it to constantly move around, or only move when you mouse to the edge, etc.
JK -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan Sent: Friday, November 07, 2008 1:53 AM To: jQuery (English) Subject: [jQuery] Re: Scrolling inside a div with mousemove Ah ok, So does that mean I need to calctulate how far up or down it can scroll? On Nov 7, 7:34 am, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > Ah, > > This part of the code: > > // Use the e.clientX and e.clientY vs this.tempPosition > // to determine how much to move the scrollbars according > // to your tastes. > > Was intended to be replaced by math that calculated the setTop and setLeft > values. > > I didn't do that part. > > JK > > -----Original Message----- > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of Dan > Sent: Thursday, November 06, 2008 8:27 PM > To: jQuery (English) > Subject: [jQuery] Re: Scrolling inside a div with mousemove > > Hi Jeffrey, > > Thank you for your reply, however I can't seem to get your code to > work. > > I'm getting an error that says "setTop is not defined" > > Any idea why this is? > > On Nov 6, 1:15 am, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > > Well, you could do something like this (completely untested, sorry). > > > The hover events bind and unbind the mousemove to prevent resource drain. > > > $('#thisdiv').hover(startScroll,stopScroll); > > > function startScroll(e) > > { > > var div = $(this).bind('mousemove',scrollThis); > > var o = div.offset(); > > this.tempPosition = { > > left:o.left, > > top:o.top, > > right:o.left+div.width(), > > bottom:o.top+div.height(), > > scrollOffsetX:this.scrollWidth-this.clientWidth, > > scrollOffsetY:this.scrollHeight-this.clientHeight, > > }; > > > } > > > function stopScroll(e) > > { > > $(this).unbind('mousemove').removeAttr('tempPosition'); > > > } > > > function scrollThis(e) > > { > > // Use the e.clientX and e.clientY vs this.tempPosition > > // to determine how much to move the scrollbars according > > // to your tastes. > > this.scrollTop = setTop; > > this.scrollLeft = setLeft; > > > } > > -----Original Message----- > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > > Behalf Of Dan > > Sent: Wednesday, November 05, 2008 2:56 PM > > To: jQuery (English) > > Subject: [jQuery] Scrolling inside a div with mousemove > > > Hello, > > > I'm trying to move from MooTools over the jQuery as it seems to be a > > much reliable and user friendly framework. > > > However I need to recreate something that I currently have MooTools > > doing but am having trouble figuring out how it would work. > > > I'm trying to replicate the effect seen in the 'mousemove' example of > > this MooTools pagehttp://demos111.mootools.net/Scroller. > > > It doesn't need to scroll left and right but it's fine if it does, I'm > > quite comfortable using JavaScript but just to warn you I'm very new > > to jQuery :) > > > Thank you very much for any help.