I think it would be great if jQuery smoothed over this browser
discrepancy/deficiency. It's especially nice to have this level of
control when dealing with image sprites. There's a 7-month-old ticket
for it here: http://dev.jquery.com/ticket/2462
From my comment on the ticket:
> - IE6 and IE7 return undefined for css('backgroundPosition') but
> return correct results for css('backgroundPositionX') and
> css('backgroundPositionY').
> - FF3 returns correct results for css('backgroundPosition') but
> returns empty string for css('backgroundPositionX') and
> css('backgroundPositionY').
> - Safari3 returns correct results for all three.
Paolo,
I've dealt with the backgroundPosition thing by doing something like
this (pasted from one of my old scripts):
var $this = $(this);
var bgp = $this.css('backgroundPosition') ||
$this.css('backgroundPositionY');
if ($this.css('backgroundPosition')) {
$this.css('backgroundPosition', (bgp.indexOf('-18px') ==
-1) ? '0 -18px' : '0 2px');
} else {
$this.css('backgroundPositionY', (bgp != '-18px') ? '-18px' :
'2px');
}
Hope that helps.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Sep 23, 2008, at 3:06 PM, John Resig wrote:
>
> Well, simply: Firefox doesn't support background-position-y, it only
> supports background-position.
>
> --John
>
>
>
> On Tue, Sep 23, 2008 at 2:29 PM, Paolo De Dionigi
> <[EMAIL PROTECTED]> wrote:
>>
>> Am I referencing to it the wrong way?
>>
>> $(".right > li > a").hover(
>> function () {
>> $(this).css({ backgroundPositionY:"0" });
>> },
>> function () {
>> $(this).css({ backgroundPositionY:"-8px" });
>> }
>> );
>>
>> I have some li containing each a a(link) tag (block, whose background
>> images are top shifted of 8 px).
>>
>> With the above code, I'd like to shift down the bg image on mouseover
>> and go back on mouseout.
>>
>> I verified that the traversing is right, simply using another
>> property
>> (opacity) and it works.
>>
>> So it must me the name of the property to be wrong, but I checked and
>> it seems right. I also tried using the name instead of the property
>> (ie: background-position-y, of course changing the sintax) but
>> without
>> results.
>>
>> Nothing happens, no errors from firebug.
>>
>> Any hint?
>>
>> Thanks
>>
>>>
>>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---