?
Solved

jquery get background position

Posted on 2011-03-03
3
Medium Priority
?
715 Views
Last Modified: 2012-05-11
Good Afternoon All,

I have a problem with some jquery/javascript that I am trying to write.  This works fine in FF but not in IE.  Imagine that.

some background - I am pasing a function 4 parameters, all strings.  noteid, marLeft, marTop, direction.

I am getting the last two characters from the noteid and assigning them to a pageid.  

I am then trying to get the background-position that is currently assigned to the pageid.  I am using:
var pgBkgd = $("#"+pageid).css('background-position');

in firefox I get something like 0px 80px
in IE I get undefined.

Can anyone help me out here?

Thanks!
Rose

0
Comment
Question by:rdurban
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 35032229
I think it should be .style(background-position) instead of .CSS

Just off the top of my head
0
 
LVL 6

Accepted Solution

by:
GregArnott earned 2000 total points
ID: 35032573
IE can be picky when it comes to background values.

You'll get the 2 values independently by using:
.css('background-position-x')
.css('background-position-y')

Unfortunately, FF doesn't like this separation of values.
0
 

Author Closing Comment

by:rdurban
ID: 35037627
what we ended up using was:

if($.browser.msie) {
            var bkgdX = $("#"+pageid).css('background-position-x');
            var bkgdY = $("#"+pageid).css('background-position-y');
            var pageBkgd = bkgdX + ' ' + bkgdY;
      } else {
            var pageBkgd = $("#"+pageid).css('background-position');
      }
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question