0
У меня есть несколько div, которые отображают разные изображения при нажатии, а затем исчезают через 5 секунд. Только я хочу, чтобы этот номер был сброшен каждый раз, когда нажимается div. Ниже приведен код, который я пытался использовать, но он не работает.jQuery setTimeout reset?
var showServicesDelay = function() {
timeoutHandle = setTimeout(function() {
jQuery(".services-inner").css({"opacity": "0.5"});
jQuery(".insignia-inner").css({"opacity": "1"});
jQuery(".insignia-inner-text").css({"opacity": "1"});
hideAll();
}, 5000);
};
var showMilitaryKit = function() {
jQuery(".military-kit-inner").css({"opacity": "1"});
clearTimeout(timeoutHandle);
};
var showProperty = function() {
jQuery(".property-inner").css({"opacity": "1"});
clearTimeout(timeoutHandle);
};
var showHomeContents = function() {
jQuery(".home-contents-inner").css({"opacity": "1"});
clearTimeout(timeoutHandle);
};
// military kit
jQuery(".military-kit-hover").click(function() {
hideAll();
hideServices();
showMilitaryKit();
showServicesDelay();
});
// property
jQuery(".property-hover").click(function() {
hideAll();
hideServices();
showProperty();
showServicesDelay();
});
// home contents
jQuery(".home-contents-hover").click(function() {
hideAll();
hideServices();
showHomeContents();
showServicesDelay();
});
+1 - Я upvote, что на скорости сдвига, что *** *** быстро! – adeneo
Я стремлюсь порадовать;) –