Compatibility between two browsers in jquery Development (ie6 and chrome)

Source: Internet
Author: User

It is convenient for people who only draw conclusions:

Ie6: the absolute position of the div. when the container is full, it is different from other browsers. other browsers will be placed below, while ie6 will be placed on the right. Remember to set the left attribute.

In chrome (webkit): document. ready is triggered before the image is loaded. When there is an image operation, it is best to use window. load


Develop a simple jquery plug-in, a div, which contains an img and a div. The plug-in calls out the img title attribute and displays it on the image to hide the div inside. When you move the cursor over the image, the hidden div is displayed below the image to provide control operations.

 

 

This is the result of the mouse.

 

After testing the browser compatibility, we found that the hidden div below is not displayed under ie6. Some images are not displayed in the core webkit browser.

 

 

 

Then begin to check. The height of the two images is not set, which is probably related to this. So I wrote a new page for testing. Finally, we found that the compatibility issue in ie6 is not related to the image height and width.

This is seen in firefox.

 

 

This is shown in ie6.

 

Originally in ie6, because no left attribute is set to hide the div positioning, ie6 gets it to the edge by default. Find the first problem.

 

When chrome looked at the source code, it found that the content was all there. the developer's tool found that the div height outside the two pictures had changed to 0, so it was not displayed.

 

 

At last, we found that $ (document). ready is different when webkit is triggered from other browsers. Others are triggered only after the image is loaded and displayed, while the webkit core is before the image is loaded.

 

This is the effect in firefox.

 

This is the effect in chrome.

 

 

Therefore, you only need to change $ (document). ready to $ (window). load to solve the problem.

 

Summary:

Ie6: the absolute position of the div. when the container is full, it is different from other browsers. other browsers will be placed below, while ie6 will be placed on the right. Remember to set the left attribute.

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.