Salut j'ai une méthode qui change l'arrière-plan d'un div toutes les quelques secondes, Comme un carrousel, lorsque l'utilisateur survole un certain texte. sur l'événement # h2Create mouseleave je veux annuler la méthode changingCarosel (arrêter le carrousel de jouer). Comment puis-je faire ceci??annuler méthode jquery sur mouseleave
$(document).ready(function() {
$("#h2Create").mouseenter(function() {
changingCarosel('create');
$("#h2Create").css("color", "#99eee5");
$("#ServiceDesc").text('WEB/MOBILE/APPS/BESPOKE DESIGN AND BUILD');
});
$("#h2Create").mouseleave(function() {
$("#h2Create").css("color", "#fff");
});
});
changingCaroselvar bgChangeTimer = {};
var bgSecondRotation = {};
var bgThirdRotation = {};
var bgFourthRotation = {};
function changingCarosel(param) {
switch (param.toString())
{
case 'create':
$("#ServicesBackgroundImage").css("background-image", "url(/images/spreadVenture.jpg)");
bgChangeTimer = $.timer(2700, function() {
$("#ServicesBackgroundImage").css("background-image", "url(/images/Spreadthorntons.jpg)");
bgSecondRotation = $.timer(2700, function() {
$("#ServicesBackgroundImage").css("background-image", "url(/images/spreadC2K.jpg)");
bgSecondRotation = $.timer(2700, function() {
changingCarosel("create");
});
});
});
break;
case 'buzz':
$("#ServicesBackgroundImage").css("background-image", "url(/images/jr.jpg)");
bgChangeTimer = $.timer(2700, function() {
$("#ServicesBackgroundImage").css("background-image", "url(/images/vufold.jpg)");
bgSecondRotation = $.timer(2700, function() {
$("#ServicesBackgroundImage").css("background-image", "url(/images/prmothean.jpg)");
bgThirdRotation = $.timer(2700, function() {
$("#ServicesBackgroundImage").css("background-image", "url(/images/dayParade.jpg)");
bgFourthRotation = $.timer(2700, function() {
changingCarosel("buzz");
});
});
});
});
break;
default:
$("#ServicesBackgroundImage").css("background-image", "url(/images/ifIruledTheWorld.jpg)");
bgChangeTimer = $.timer(2700, function() {
$("#ServicesBackgroundImage").css("background-image", "url(/images/Spreadthorntons.jpg)");
bgSecondRotation = $.timer(2700, function() {
$("#ServicesBackgroundImage").css("background-image", "url(/images/spreadC2K.jpg)");
bgSecondRotation = $.timer(2700, function() {
changingCarosel("spread");
});
});
});
break;
}
}
ma question a été brisée ici par les commutateurs que j'ai. ils sont utilisés pour déterminer quel texte est survolé par l'utilisateur. –