dimanche 18 mai 2014

version - conflit de JQuery 1.5.2 à Jquery 1.6 ou supérieur - Stack Overflow


i have a problem with this code and i cant't find the problem. It works with JQuery 1.5.2 and lower, but not with JQuery 1.6 and higher.


Here is the code and thanks for your help!


$(document).ready(function () {

$(".selected").stop().animate({'backgroundPosition':'(0 -28)'}, {duration:200});

$('#ver li a').hover(

function ()
{
if (!($(this).hasClass("selected")))
{
height = $(this).height() * (1);
$(this).stop().animate({'backgroundPosition':'(0 ' + -height + ')'}, {duration:200});
}
},

function ()
{
if (!($(this).hasClass("selected")))
{
$(this).stop().animate({'backgroundPosition':'(0 0)'}, {duration:200});
}
}
);

});



I ran into a similar problem, but in my case I was animating just the X axis of the background using something like "backgroundPosition: '+=1350px 0px'", for some reason this stopped working once I went to jQuery 1.6.2... All my other animate instances were working fine, on the same block.


In the end (after a long debug session), I noticed that if I removed the Y-Axis value from the call, it worked. so "backgroundPosition: '+=1350px 0px'" doesnt work anymore, but "backgroundPosition: '+=1350px'" works. The odd thing is that it doesnt even throw an error at you, the animate does process, but nothing happens (so, no error). As of now, I cant figure a way to animate a background image on the Y axis.




Martin, I recommend you download and utilize a DIFF tool, such as WinMerge (http://winmerge.org/) to see the differences between the two versions of jQuery itself.


Analyze the changes, looking specifically for changes in functions that you are using in your code. For example .animate(), .hasClass(), .height(), etc.


I believe you will find the answer after that.


Alternatively, you could analyze the changelogs for each of the versions of jQuery. from 1.5.2 up to 1.6.



i have a problem with this code and i cant't find the problem. It works with JQuery 1.5.2 and lower, but not with JQuery 1.6 and higher.


Here is the code and thanks for your help!


$(document).ready(function () {

$(".selected").stop().animate({'backgroundPosition':'(0 -28)'}, {duration:200});

$('#ver li a').hover(

function ()
{
if (!($(this).hasClass("selected")))
{
height = $(this).height() * (1);
$(this).stop().animate({'backgroundPosition':'(0 ' + -height + ')'}, {duration:200});
}
},

function ()
{
if (!($(this).hasClass("selected")))
{
$(this).stop().animate({'backgroundPosition':'(0 0)'}, {duration:200});
}
}
);

});


I ran into a similar problem, but in my case I was animating just the X axis of the background using something like "backgroundPosition: '+=1350px 0px'", for some reason this stopped working once I went to jQuery 1.6.2... All my other animate instances were working fine, on the same block.


In the end (after a long debug session), I noticed that if I removed the Y-Axis value from the call, it worked. so "backgroundPosition: '+=1350px 0px'" doesnt work anymore, but "backgroundPosition: '+=1350px'" works. The odd thing is that it doesnt even throw an error at you, the animate does process, but nothing happens (so, no error). As of now, I cant figure a way to animate a background image on the Y axis.



Martin, I recommend you download and utilize a DIFF tool, such as WinMerge (http://winmerge.org/) to see the differences between the two versions of jQuery itself.


Analyze the changes, looking specifically for changes in functions that you are using in your code. For example .animate(), .hasClass(), .height(), etc.


I believe you will find the answer after that.


Alternatively, you could analyze the changelogs for each of the versions of jQuery. from 1.5.2 up to 1.6.


0 commentaires:

Enregistrer un commentaire