Share on Google+Share on Google+

jQuery UI Utility : Position

This page discusses - jQuery UI Utility : Position

jQuery UI Utility : Position


jQuery UI Utility : Position

The position utility script is used for positioning any widget relative to the window, document, a particular element, or the cursor/mouse.

It do not need ui.core.js or effects.core.js.



<!DOCTYPE html>
<link href="
/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="">
<script src="">
<style type="text/css">
#targetElement { width:240px;height:200px;background-color:#999;margin:30px auto;
.positionDiv { width:50px;height:50px;opacity:0.6; }
#position1 {background-color:#F00;}
#position2 {background-color:#0F0;}
#position3 {background-color:#00F;}
#position4 {background-color:#FF0;}

$(document).ready(function() {

my: "center",
at: "center",
of: "#targetElement"
my: "left top",
at: "left top",
of: "#targetElement"
my: "right center",
at: "right bottom",
of: "#targetElement"
my: "left bottom",
of: ev,
offset: "3 -3",
collision: "fit"

<body style="font-size:62.5%;">

<div id="targetElement">
<div class="positionDiv" id="position1"></div>
<div class="positionDiv" id="position2"></div>
<div class="positionDiv" id="position3"></div>
<div class="positionDiv" id="position4"></div>


Output :

Download Source Code

Click here to see online demo

Learn from experts! Attend jQuery Training classes.


Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: jQuery UI Utility : Position  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image