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')); }); 

fiddle

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);   

demo: http://jsfiddle.net/3gskot27/3/


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -