Currently, I am working on a jQuery animation where clicking on a tile should display its information by hiding all other tiles and showing its details. While I have implemented .stop() to prevent queuing issues, I encountered a problem with the transition when it comes to the core jQuery functionality.
The code is divided into 3 parts: mouseenter event changes the opacity of each tile, mouseleave event resets the opacity or adjusts others if necessary, and finally, the click function fades out the rest of the tiles and displays the product description. The challenge arises in the third part, specifically with the interference caused by the .stop() function during the animation if the mouse obstructs the process.
function bannerFader(currentBanner, otherBanners, expandButton, appendInfo){
var disableHover = false;
$(currentBanner).mouseenter(function(){
if (disableHover == false) {
$(otherBanners).stop(true);
$(otherBanners).fadeTo(100, .8);
}
});
$(currentBanner).mouseleave(function(){
if (disableHover == false) {
$(otherBanners).fadeTo(100, 1);
};
});
$(expandButton).click(function(){
disableHover = true;
$(otherBanners).hide(200, function(){
$(appendInfo).show(300);
});
});
}
function autoRunner() {
bannerFader('.banner-one', '.banner-two, .banner-three, .banner-four, .banner-five', '.banner-one','.append-one')
bannerFader('.banner-two', '.banner-one, .banner-three, .banner-four, .banner-five', '.banner-two','.append-two')
bannerFader('.banner-three', '.banner-two, .banner-one, .banner-four, .banner-five', '.banner-three','.append-three')
bannerFader('.banner-four', '.banner-two, .banner-three, .banner-one, .banner-five', '.banner-four','.append-four')
bannerFader('.banner-five', '.banner-two, .banner-three, .banner-four, .banner-one', '.banner-five','.append-five')
};
In essence, I aim to retain the current functionality without the interference of .stop(). For reference, you can view an example of the issue here: