Revision: 27728
Updated Code
at June 22, 2010 04:36 by chrisjlee
Updated Code
Markup:
<script src="http://jquery-ui.googlecode.com/svn/trunk/jquery-1.4.2.js"></script>
<script src="http://jquery-ui.googlecode.com/svn/trunk/ui/jquery.ui.position.js"></script>
<div id="foo">
My centered foo box
</div>
<script>
$('#foo')
.css({ top: 0, left: 0 })
.position({
my: 'center center',
at: 'center center',
collision: 'fit',
of: window,
using: function(pos) {
var topOffset = $(this).css(pos).offset().top;
if (topOffset < 0) {
$(this).css('top', pos.top - topOffset);
}
}
});
</script>
Revision: 27727
Updated Code
at June 22, 2010 04:35 by chrisjlee
Updated Code
Markup:
<script src="http://jquery-ui.googlecode.com/svn/trunk/jquery-1.4.2.js"></script>
<script src="http://jquery-ui.googlecode.com/svn/trunk/ui/jquery.ui.position.js"></script>
<div id="foo">
My centered foo box
</div>
$('#foo')
.css({ top: 0, left: 0 })
.position({
my: 'center center',
at: 'center center',
collision: 'fit',
of: window,
using: function(pos) {
var topOffset = $(this).css(pos).offset().top;
if (topOffset < 0) {
$(this).css('top', pos.top - topOffset);
}
}
});
Revision: 27726
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 22, 2010 04:33 by chrisjlee
Initial Code
$('#foo')
.css({ top: 0, left: 0 })
.position({
my: 'center center',
at: 'center center',
collision: 'fit',
of: window,
using: function(pos) {
var topOffset = $(this).css(pos).offset().top;
if (topOffset < 0) {
$(this).css('top', pos.top - topOffset);
}
}
});
Initial URL
hire.chrisjlee.net
Initial Description
Initial Title
Use Jquery's new Position function in the UI to center anything
Initial Tags
javascript, plugin, jquery
Initial Language
jQuery