Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#6157 closed bug (worksforme)

$(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.

Change History (3)

comment:1 Changed 10 years ago by david71rj

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.

comment:2 Changed 10 years ago by david71rj

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.

comment:3 Changed 9 years ago by dmethvin

Priority: undecided
Resolution: worksforme
Status: newclosed

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

Note: See TracTickets for help on using tickets.