jQuery not working in FF

  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Joined: Aug 04, 2008
  • Posts: 846
  • Status: Offline

Post September 15th, 2009, 7:04 pm

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. });
Use your words like arrows to shoot toward your goal.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 15th, 2009, 7:04 pm

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post September 15th, 2009, 7:45 pm

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.
Strong with this one, the sudo is.
  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Joined: Aug 04, 2008
  • Posts: 846
  • Status: Offline

Post September 15th, 2009, 9:02 pm

okay, how do I declare the individual properties? In which order and in what syntax do I combine them with jQuery?
Use your words like arrows to shoot toward your goal.
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post September 15th, 2009, 9:27 pm

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')
Strong with this one, the sudo is.
  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Joined: Aug 04, 2008
  • Posts: 846
  • Status: Offline

Post September 15th, 2009, 10:18 pm

that's simple enough, thanks jb
Use your words like arrows to shoot toward your goal.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 115 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
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.