I’ve been fiddling a bit with jQuery for a small project of mine,* and ended up needing to position an element somewhere on the screen. This gets fiddly in CSS when you don’t know the exact size of the element, but in jQuery, it’s a breeze. At least with my little plugin.
It’s easy as pie to use on your jQuery site, you just:
- Download jQuery_centerOn.js to the js folder on your site.
- Add the following code to the <head> of the page you wish to use it on:
- Use the following command to position the element in question:
In this example you would center the element with id testThing on the point (300,200).
That’s all there is to it!