Problems with obtaining background-position using jquery

Source: Internet
Author: User
Question about obtaining background-position using jquery

When using jquery (Version 1.3.2), $ ("a div" Development .css ("background-position") cannot be obtained in all versions of IE, and the returned results are undefined.

Later, I checked the data and found that I could not obtain this attribute in IE. I could only obtain background-position-X and background-position-y.

So Code Must be modified.
VaR defaultpoint = [];
VaR P = $ ("# welcomepanel P" ).css ("background-position ");
// Here is the IE fix, and the background-position cannot be obtained in IE,
// Only background-position-X and background-position-y can be obtained.
If (typeof (p) = "undefined "){
Defaultpoint [0] = $ ("# welcomepanel P" ).css ("background-position-X ");
Defaultpoint [1] = $ ("# welcomepanel P" ).css ("background-position-y ");
} Else {
Defaultpoint = P. Split ("");
}

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.