oh wow. good call, Ariel. thanks!

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jan 8, 2009, at 4:42 PM, Ariel Flesler wrote:


@Karl

$('html, body') is a simple, yet bad, approach.
It's one or the other not both.
Browsers like Opera that react to both elements, can go mad when doing
this.

Cheers

--
Ariel Flesler
http://flesler.blogspot.com

On Jan 8, 1:20 pm, Karl Swedberg <[email protected]> wrote:
Hi there,

Here's a quick and dirty way to do it, off the top of my head. Totally
untested, but should get you started, at least:

// determine left and top position of img

var imgLeft = $('#yourImage').offset().left;
var imgTop = $('#yourImage').offset().top;

// on click, grab the coords attribute of the area and add them to the
img position for animating

$('area').click(function() {
   var toArea = $(this).attr('href');
   var coords = $(toArea).attr('coords').split(',');
   $('html, body').animate({
     scrollLeft: imgLeft + coords[0],
     scrollTop: imgTop + coords[1],
   }, 400);

});

--Karl

____________
Karl Swedbergwww.englishrules.comwww.learningjquery.com

On Jan 7, 2009, at 5:14 PM, schnuck wrote:



...what if the areas i need to scroll to are defined as anchors in
html <map> elements on top of a large inline image? and the areas that
trigger the links are image map areas too. clicking on the image map
areas scroll from one area to another. ideally not using absolute
positioning, but with html anchors and their IDs.

i tried modifying this technique here for no avail:

http://www.learningjquery.com/2007/10/improved-animated-scrolling-scr ...

and this one here:

http://plugins.jquery.com/project/scrollto

any help appreciated - thanks!



Reply via email to