jQuery

  • Kurthead+1
  • Graduate
  • Graduate
  • Kurthead+1
  • Posts: 131

Post 3+ Months Ago

Does anybody know a way to change the size of a background IMAGE in jQuery? I know I can just make an image larger, but background-image seems to be a little bit trickier. If I can't find a way I'll just go about this a different way, using an actual image, but based on the situation it's kind of important that I use a background-image rather than just an image, because it creates a frame around another div, so I need to put it in a div around this div as a background-image.
Thanks to anyone that knows.

Oh, this needs to be in an animte() rather than css()

If it helps, I found that you can change background image size like this in css:

-o-background-size: 200px 50px;
-webkit-background-size: 200px 50px;
-khtml-background-size: 200px 50px;
-moz-background-size: 200px 50px;
background-size: 200px 50px;

But I've tried this in animate function and it doesn't work.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 477

Post 3+ Months Ago

what about something like (UNTESTED)
JAVASCRIPT Code: [ Select ]
$(this).animate({"-o-background-size":"200px 50px","-webkit-background-size":"200px 50px","-khtml-background-size":"200px 50px","-moz-background-size":"200px 50px","background-size":"200px 50px"}, 1000);
 
  1. $(this).animate({"-o-background-size":"200px 50px","-webkit-background-size":"200px 50px","-khtml-background-size":"200px 50px","-moz-background-size":"200px 50px","background-size":"200px 50px"}, 1000);
  2.  

Post Information

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

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