-2

hello good afternoon community. I want to move your background-position in xa this image to act as a video but do not mistake that I have Thanks before hand

$(document).ready(function() {
    $('.imagen').mouseenter(function(){
        var numero = -535;
        var suma;
        for (var i = 1; i <= 10; i++) {
            $(this).css({'backgroundPosition': suma+"px 0px"}, "-10");
            suma = numero * i;
        }
    }
});

http://jsfiddle.net/kiokotzu/zw8rB/

Alessio
  • 3,404
  • 19
  • 35
  • 48

2 Answers2

1

you should use background-position not backgroudPosition in '' and there was a syntax error as you did not close brackets

http://jsfiddle.net/zw8rB/2/

$(document).ready(function() {
    $('.imagen').mouseenter(function(){
        var numero = -535;
        var suma;
        for (var i = 1; i <= 10; i++) {
            $(this).css({'background-position': suma+"px 0px"}, "-10");
            suma = numero * i;
        }
    }
);
    });
Hushme
  • 3,108
  • 1
  • 20
  • 26
0

There are 2 reasons why your script wasn't working.

  1. Your CSS ~ jQuery element wasn't vaild, here is a vaild one:

    $(this).css({'background-Position': suma + "px 0px"}, "-10");

  2. you had missing ); in the one of the }, so the function wasn't excute. ( }); )

Yotam
  • 350
  • 2
  • 14