jquery - Background image scroll smoothly to certain (x,y) point -
i built 'window' div
, larger image (its map of world) behind it, user can "grab" , scroll direction. next goal let user choose country , map center around country. since custom map need input coordinates self, no problem here. right (for demo purposes) created point image centers. transition immediate, how can scroll smoothly x,y
point using jquery animate
property?
right now, how scroll points:
var country_1 = new position(-700,-800); $("button").click(function(){ country_1.apply(document.getelementbyid('draggableelement')); });
you can use animate
method animate change:
var anim = {}; if(!isnan(this.x)) anim.left = this.x; if(!isnan(this.y)) anim.top = this.y; $(element).animate(anim, 1000);
Comments
Post a Comment