The dynamic Add DOM node of IE to trigger Window.resize event _javascript Tips

Source: Internet
Author: User
The page then has several events that dynamically increase the DOM element, such as clicking on a layer to list the details below, so that there is no problem with FF and Chrome, but it is ie6-8 every time under the sun.

For example, I drag a layer, in the middle of the drag process is displayed at the bottom of the layer, when I release the layers of this layer will jump back to the position before the drag ...

At first I didn't see it was a heavy layout ... Then demonstrated n long, struggled for n long, finally feel that may be due to the dynamic increase in the DOM node caused by the trigger window.resize and make the page layout ...

In the end I shouted in the heart of "Thank godness ...", it is OK to change the height of the window on the page layout has no effect, or really want to trouble dead ...

Copy Code code as follows:

Bindresizewindow:function () {
var obj = this;
$ (window). Resize (function () {
var newwidth = $ (window). width ();
if (newwidth = = obj.windowwidth) {return;}
Obj.initui ();
Obj.createui ();
Obj.windowwidth = Newwidth;
});
},


The only way to trigger a heavy-layout event is to only change the width of the binding method.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.