Bug Tracker

Ticket #6755 (closed bug: worksforme)

Opened 4 years ago

Last modified 4 years ago

width() and height() function failure

Reported by: dbzprogrammer Owned by:
Priority: undecided Milestone: 1.4.3
Component: dimensions Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

Description

I've been developing a slideshow for a contracted project, and I've found that the width() and height() function set the style attribute for the selected elements. This is fine; however, it seems that once the style attribute is set, width() and height() won't search any deeper than the elements blank style attribute for CSS styles.

Scenario:

I retrieve the height of an element with height() and the style tag becomes set to "", though the CSS class has plenty of stylization (including height). I later go to call height() again, and I get 0 for the height. The style attribute may have other CSS styles set, such as width, position, or display.

I've found a workaround, but I figured I'd let you guys know.

Thanks.

Change History

comment:1 Changed 4 years ago by addyosmani

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to worksforme

I've created a live test case outputting both the values obtained for height() and width() but also those for the direct style attributes related to these here:  http://jsfiddle.net/sVXHw/1/

As you can see (test FF, Chrome, Safari, IE) here there are no problems in retrieving the height at any point. You can click the div as many times as you want or execute additional functions later on but you'll still be able to retrieve the values of these attributes.

There may be an issue with the code you're writing for your slideshow. If you would like additional assistance in figuring out what the cause may be, please feel free to make a post in the forums.

Thanks!

Note: See TracTickets for help on using tickets.