I want to fall in love with jQuery UI’s positioning feature but everytime I run the attached code I get the following errors in javascript’s console:
firefox:
(b[this] || "").split is not a function
chromium: Uncaught TypeError: Object [object Object] has no method ‘split’
I’ve downloaded the full jquery-UI package and included the css, jQuery-min and jQuery-UI-min.
Not sure if I’m just using it wrong and missing a simple thing to kick of the magic. I tried to mimic the example from the project webpage :C At least I hope the current version is not broken :C
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="styleSheet" type="text/css" href="jquery-ui-1.8.18.custom.css" />
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
$( function() {
function position( using ) {
$("#main").position({
of: $( "#head" ),
my: $( "right top"),
at: $( "right bottom")
});
}
position();
});
</script>
</head>
<body>
<div id="head" style="background-color: #F21; height: 7%">
Menu
</div>
<div id="main" style="background-color: #1A9; width: 50%; height: 50%; position: absolute">
<h1>Jules Verne</h1>
</div>
</body>
</html>
You’re passing the wrong parameters to “my” and “at”. You just need to pass a string, not a jQuery object. Do it like this instead:
jsFiddle example.
(updated code and jsfiddle to match question edit)