我正在学习 JQuery,为此我做了这项工作。当我将鼠标悬停在缩略图上时,我遇到了问题,所有工具提示都打开了,我只想打开相关的工具提示,我不想为此使用多个类,我想用相同的类来完成这项工作。有没有什么方法可以在不为每个缩略图单独类的情况下完成这项工作?
这是链接:http://shahfahad.com/jquery/hide-show.html
enter image description here 检查随附的屏幕截图
最佳答案
试试这个脚本
<script>
$(document).ready(function(){
$(".model").css("display","none");
$(".hide").click(function(){
$(".show").closest("ul").removeClass("showing");
$(".model").hide();
});
$(".show").mouseover(function(){
if(!$(this).closest("ul").hasClass("showing")){
$(this).closest("ul").addClass("showing");
$(this).next(".model").show();
}
});
});
关于jquery - 如何在 JQuery 中打开具有相同类的单独工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48090090/