jQuery not working in FF

  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

This code seems to work just fine in IE7/8, Chrome, and Safari. But not in firefox. Anyone know why?

JAVASCRIPT Code: [ Select ]
$(document).ready(function() {
$('#hostingbutton').css('background-position-x','-632px')
 
$('#mainnavlist li').hover(
      function() {
         $(this).css('background-position-x','-316px')
      },
      function() {
         $(this).css('background-position-x','0px')      
      });
$('#mainnavlist li').click(function() {
         $('#mainnavlist li').css('background-position-x','0px');
         $(this).css('background-position-x','-632px')
         });
});
  1. $(document).ready(function() {
  2. $('#hostingbutton').css('background-position-x','-632px')
  3.  
  4. $('#mainnavlist li').hover(
  5.       function() {
  6.          $(this).css('background-position-x','-316px')
  7.       },
  8.       function() {
  9.          $(this).css('background-position-x','0px')      
  10.       });
  11. $('#mainnavlist li').click(function() {
  12.          $('#mainnavlist li').css('background-position-x','0px');
  13.          $(this).css('background-position-x','-632px')
  14.          });
  15. });
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Sledgehammer
  • Genius
  • User avatar
  • Posts: 13496
  • Loc: Florida

Post 3+ Months Ago

Because you're using a version of Firefox that doesn't recognize the background-position-x property ?

Open up Firefoxes Error Console. If you're using a version without support, you should see something about that rule being dropped. Then again, place the rule in actual CSS and look at the console just to make sure jQuery doesn't interfere.

In any event, you'll want to forget about using that property and stick with using the background-position property with both dimensions if you want to avoid problems.
  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

okay, how do I declare the individual properties? In which order and in what syntax do I combine them with jQuery?
  • joebert
  • Sledgehammer
  • Genius
  • User avatar
  • Posts: 13496
  • Loc: Florida

Post 3+ Months Ago

Remove the "-x" from the property name. Put a space and the y position in the value.

JAVASCRIPT Code: [ Select ]
.css('background-position','-632px 0')
  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

that's simple enough, thanks jb

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 77 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.