Skip to main content

Bug Tracker

Side navigation

#3804 closed bug (invalid)

Opened January 07, 2009 02:53PM UTC

Closed January 17, 2009 10:06PM UTC

Bug using animate()

Reported by: gzoller Owned by:
Priority: major Milestone: 1.3
Component: dimensions Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:
Description

Using code below I got the following error in jquery-1.3b1.js on line 3901 (Incidentally this same code produces an exception in current 1.2.6 jQuery.)

this[0].ownerDocument is undefined

offset()()jquery-1.3b1.js (line 3901)

position()()jquery-1.3b1.js (line 3994)

moveBar()foo2.html# (line 7)

onclick(click clientX=102, clientY=28)J8q6JkoH...d8Q%3D%3D (line 2)

[Break on this error] if ( this[0] === this[0].ownerDocument...urn jQuery.offset.bodyOffset( this[0] );

Code Used:

<html>

<head>

<script type="text/javascript" src="jquery-1.3b1.js"></script>

<script type="text/javascript">

function moveBar() {

var newLeft = $(this).position().left;

$("#slider").animate({"left": newLeft}, 2000);

}

</script>

<style type="text/css">

/*------ Containters ------*/

#tabs{

width:100%;

height:37px;

background:#ffffff;

overflow:hidden;

}

#m-top{

height:33px;

}

/*------ SLIDER ------*/

#slider{

width:50px;

height:5px;

float:left;

line-height:0px;

margin-top:0px;

display:inline;

font-size:1px;

background:#BED6F8;

}

/*------ MENU ------*/

#tabs ul{

padding:0px;

margin:0px;

list-style:none;

}

#tabs ul li{

display: block;

float: left;

text-align: center;

padding: 0;

margin: 0;

}

#tabs ul li a{

margin:0px;

padding:5px 5px 5px 5px;

margin:5px 0px 0px 0px;

display: block;

text-decoration:none;

font-size:12;

color:#313131;

border-left:solid 1px #e1e1e1;

}

#tabs ul li.first a {

border-left:none;

}

#tabs ul li a:hover{

color:#7878ff;

}

</style>

</head>

<body>

<form>

<div id="tabs">

<div id="m-top">

<ul>

<li class="first">

<a href="#" onclick="moveBar()">Create Roles</a>

</li>

<li>

<a href="#" onclick="moveBar()">Assign Roles</a>

</li>

<li>

<a href="#" onclick="moveBar()">Remove Roles</a>

</li>

<li>

<a href="#" onclick="moveBar()">List Roles</a>

</li>

</ul>

</div>

<div id="slider"></div>

</div>

</form>

</body>

Attachments (0)
Change History (1)

Changed January 17, 2009 10:06PM UTC by john comment:1

component: unfilleddimensions
resolution: → invalid
status: newclosed

Umm - you're binding those strangely. Why not just do:

  $("li").click(moveBar);

Right now the 'this' is equal to the default (which is the window) and thus not working.