Skip to main content

Bug Tracker

Side navigation

#6157 closed bug (worksforme)

Opened February 24, 2010 03:14AM UTC

Closed November 14, 2010 03:12AM UTC

Last modified March 13, 2012 11:45PM UTC

$(window).resize() bug elements on Webkit

Reported by: david71rj Owned by:
Priority: undecided Milestone: 1.4.2
Component: event Version: 1.4.1
Keywords: window, resize Cc:
Blocked by: Blocking:
Description

HTML:

<div id="main"></div>

CSS (I do with normal CSS):

#main {

position: absolute;

width: 760px;

min-height: 540px;

}

JS:

$(function(){

$(window).resize(function(){

console.log($("#main").width()); Bug: Will return $(window).width() instead!!!

});

$(window).resize(); Here start the bug

});

If you resize normally the page, this works fine, but automatically, don't.

Bye.

Attachments (0)
Change History (3)

Changed February 24, 2010 03:20AM UTC by david71rj comment:1

HTML:

<div id="main"></div>

CSS (I do with normal CSS):

#main {
  position: absolute;
  width: 760px;
  min-height: 540px;
}

JS:

$(function(){
  $(window).resize(function(){
    console.log($("#main").width());
    // Bug: Will return $(window).width() instead!!!
  });
  $(window).resize(); // Here start the bug
});

If you resize normally the page, this works fine, but automatically, don't.

Bye.

Changed February 24, 2010 03:24AM UTC by david71rj comment:2

Sorry, this occur if you load CSS after JS. Then CSS style is applied after. The stranger is that I'm using $READY method, or be, all is ready to apply changes.

It's can be considered bug?

Bye.

Changed November 14, 2010 03:12AM UTC by dmethvin comment:3

priority: → undecided
resolution: → worksforme
status: newclosed

Load the css before the js, that's important on webkit browsers.