Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Jquery animate - Type error: * is not a function

    Please help, I am trying to apply a slide up animation on a background image but I am not sure I am writing my code correctly.

    Firstly, I am getting a type error: * is not a function

    secondly, I think I need to add CSS styling property to background-position: -182px and not just bottom: '-182'

    Code:
    <script type="text/javascript">
    	  $(document).ready(function() {
    		// on mouse over
    		$("ul#sections li#who").hover(function () {
    			// animate opacity to full
    			$(this).stop().animate({
    				bottom: '-182'
    			}, 'slow');
    		},
    		// on mouse out
    		function () {
    			// animate opacity to nill
    			$(this).stop().animate({
    				top: 0
    			}, 'slow');
    		});
    	});
    </script>

  • #2
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    ok, I just changed code to this:

    Code:
    <script type="text/javascript">
    $('ul#sections li#who').css({
        backgroundPosition: "0% 0%"
    }).hover(
        function() {
            $(this).stop().animate({
                'background-position-x': "50%"
            }, "600");
        }, function() {
            $(this).stop().animate({
                'background-position-x': "0%"
            }, "600");
        }
    );
    </script>
    still nothing

  • #3
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    Let me guess ... you are testing in Firefox? Sadly, Mozilla has removed the support for background-position-x and background-position-y as of FF3 claiming that they were not part of specification. So it just won't work in Firefox any more. If you test in Chrome for example, it should work, though.

    I haven't come across a working version of .animate() for background-position yet.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •