Skip to main content

Bug Tracker

Side navigation

#6581 closed bug (invalid)

Opened May 18, 2010 12:03PM UTC

Closed October 15, 2010 01:33AM UTC

width() in opera

Reported by: Nau Owned by:
Priority: low Milestone: 1.4.3
Component: offset Version: 1.4.2
Keywords: width opera Cc:
Blocked by: Blocking:
Description

jQuery('#top-menu .menu').width();

in firefox width() = ~450px - correct, but Opera not correct 950px.

Style:

ul.menu {float:left; display:inline}

Html:

<div id="top-menu">

<ul class="menu"><li class="item1"><a href="#"><span>item1</span></a></li><li class="parent item2"><a href="#"><span>item2</span></a></li><li class="parent active item4" id="current"><a href="#"><span>item3</span></a><ul><li class="item5"><a href="#"><span>item4</span></a></li></ul></li><li class="item11"><a href="#"><span>item5</span></a></li><li class="item12"><a href="#"><span>item6</span></a></li><li class="parent item6"><a href="#"><span>item7</span></a></li><li class="item13"><a href="#"><span>item8</span></a></li><li class="parent item8"><a href="#"><span>item9</span></a></li></ul></div>

Attachments (0)
Change History (1)

Changed October 15, 2010 01:33AM UTC by addyosmani comment:1

priority: → low
resolution: → invalid
status: newclosed

I believe that the reason you're getting such variable results for width() is that you haven't actually explicitly defined what the dimensions of your menu component are supposed to be (in this case via CSS or JS). When no CSS declarations for these attributes (width, height etc) are defined, your browser may be falling back on a default stylesheet (or a custom stylesheet that may be used as the default depending on your settings) and this tends to vary from browser to browser - different default stylesheets may have alternating values for things like default padding, margin etc. For an accurate test, please define the CSS dimensions for your component and it's children and if the value of width() continues to be erroneous feel free to re-submit your ticket for evaluation and we'll review once again.