Bug Tracker

Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#7305 closed bug (worksforme)

Cant retrive current left and top css when $(obj) is hidden

Reported by: svcorp77 Owned by:
Priority: low Milestone: 1.next
Component: css Version: 1.5
Keywords: top left css Cc:
Blocked by: Blocking:

Description

var winObj = $('<div>Left AND Top set to Zero</div>')

.hide()
.appendTo('body')
.css({

width : 100,
height : 100,
left : '100px',
top : '100px',
position : 'absolute',
opacity : 0

}).animate({

width : 420,
height : 150,
opacity : 1,
left : ($(window).width() / 2 - 210) + 'px',
top : Math.round($(window).height() / 5) + 'px'

}, 450, function() {

console.log('animation complete');
console.log(winObj.attr('style'));
console.log(winObj.css('left'));
console.log(winObj.css('top'));

});

console.log(winObj.attr('style'));
console.log(winObj.css('left'));
console.log(winObj.css('top'));


display: none; width: 100px; height: 100px; left: 0px; top: 0px; position: absolute; opacity: 0; overflow: hidden;
0px
0px
animation complete
display: none; width: 420px; height: 150px; left: 741.5px; top: 117px; position: absolute; opacity: 1;
0px
0px

JQuery 1.43Pre display it correctly.

Change History (12)

comment:1 Changed 13 years ago by anonymous

JQuery 1.43

comment:2 Changed 13 years ago by addyosmani

Component: unfiledcss
Keywords: top left css added
Priority: undecidedlow

See http://jsfiddle.net/addyosmani/F9LKa/

The 1.4.2 output of your code is:

display: block; width: 100px; height: 100px; left: 100px; top: 100px; position: absolute; opacity: 0; overflow: hidden; 100px 100px animation complete display: block; width: 420px; height: 150px; left: 38px; top: 97px; position: absolute; opacity: 1; 38px 97px


The 1.4.3 output is:

display: none; width: 100px; height: 100px; left: 0px; top: 0px; position: absolute; opacity: 0; overflow: hidden; 0px 0px animation complete display: none; width: 420px; height: 150px; left: 38px; top: 97px; position: absolute; opacity: 1; 0px 0px


And the Current Git Version output is:

display: none; width: 100px; height: 100px; left: 0px; top: 0px; position: absolute; opacity: 0; overflow: hidden; 0px 0px animation complete display: none; width: 420px; height: 150px; left: 38px; top: 97px; position: absolute; opacity: 1; 0px 0px


On first glances, this may be related to #7225, but as we've closed that as fixed and your code is currently not working using that fix, I'm leaving open for further review.

comment:3 Changed 13 years ago by SlexAxton

Status: newopen

properly setting to 'open'. tsk tsk addy. ;-)

comment:4 Changed 13 years ago by anonymous

Confirmed, this happed to me too. v1.4.4

comment:5 Changed 13 years ago by anonymous

$(obj).position() is also reporting incorrectly when $(obj) is hidden.

comment:6 Changed 13 years ago by anonymous

And on a final note, a workaround is doable as so, though not optimal.

$(obj).toggle(); var top = $(obj).css("top"); $(obj).toggle();

comment:7 Changed 12 years ago by svcorp77

Here is solution for:
jQuery JavaScript Library v1.5, string 7610, function jQuery.fx.prototype.update
jQuery version > 1.4.3: the same mods.


// Set display property to block for height/width animations
		if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
			this.elem.style.display = "block";
		}

Please, make this changes next update.

comment:8 Changed 12 years ago by jitter

Milestone: 1.next
Version: 1.4.31.5

comment:9 Changed 12 years ago by jitter

#8167 is a duplicate of this ticket.

comment:10 Changed 12 years ago by Rick Waldron

#8477 is a duplicate of this ticket.

comment:11 Changed 12 years ago by mikesherov

not seeing this issue in 1.7b2 nor latest git. I'm not sure this bug is still valid.

comment:12 Changed 11 years ago by mikesherov

Resolution: worksforme
Status: openclosed

I can no longer reproduce this bug. Since no new reports have come in, I'm considering this closed. Please reopen with a repro case if you feel this is an error.

Note: See TracTickets for help on using tickets.