Tag: mouseout

jQuery – 使用.mouseout或更合适的方法关闭下拉列表,提示?

我有以下代码: $(“.option_box .option_name”).click(function () { $(this).siblings(“.collapsible”).toggle(); $(this).toggleClass(“hided”); }); $(“.option_box .attribute_group_name”).click(function () { $(this).siblings(“.attribute_box”).toggle(); $(this).toggleClass(“hided”); }); 与之关联的HTML代码是: Gama Correcta Aficionado Entusiasta Purista Exclusive 哪个,在视觉上产生这个: 我的问题是我想要下拉(实际上是一个带有桌子的div元素)当我将鼠标移出它时关闭但是,正如你所看到的,它不是那么容易,因为它不是一个像我在开始时那样声明.mouseout事件的问题。 下拉列表由两部分组成,即“标题”和“正文”,当我放弃其中任何一个时,我希望整个下拉列表关闭,但到目前为止,没有运气。 我在jQuery中缺乏一些真正的知识(这里和那里只是一个简单的触摸,但暂时没什么了不起的),所以我很困惑。 我试过.mouseout,.mouseleave,.focusout和其他方法。 我甚至使用jQuery ++来使用.within方法,但我同样迷失了。 你们有没有人能指出我正确的方向?

在指定的div上鼠标拖出并保持原始div打开

我正在尝试用简单的英语做这个:我有一个来自鼠标hover事件的开放div,当我将鼠标从鼠标移出div时,鼠标完全关闭。 我需要的是,当我鼠标输出时,如果我将鼠标输出到具有类x或类y的div,则openDiv将不会关闭,除了类x或类y之外的任何其他div上的任何鼠标都将导致openDiv关闭。 这是我到目前为止所做的,但它不起作用: $(“#openDiv”).mouseout(function () { var $c = $(e.target); //div where mouse is if ($c.is(‘div.x’) || (‘div.y’)) //if div where mouse is has class x or y { $(“#openDiv”).show(); //show or keep open from the mouseover event } else { $(“#openDiv”).hide(); //hide openDiv if mouse is anywhere outside openDiv or div with class x […]

当mouseout时隐藏div

我有两个div,一个用于简短摘要,一个用于长摘要。 当我在简短摘要中“鼠标hover”时,简短摘要消失并显示长摘要。 当我从长摘要中“鼠标移出”它应该消失并且应该出现简短摘要。 问题是,当我仍然在长摘要的边界内但是在排序摘要的位置之外时,会发生mouseout事件 码: function show(Fdiv) { $(Fdiv).css(“display”, “none”); $(Fdiv).next().css(“display”, “inline”); } function hide(Sdiv) { $(Sdiv).css(“display”, “none”); $(Sdiv).prev().css(“display”, “inline”); } Sort summary Second Row Long Summary Second Row Third Row Fourth Row

鼠标hover时更改背景颜色,并在mouseout后删除它

我有桌子哪个类是forum 。 我的jquery代码: $(document).ready(function() { $(‘.forum’).bind(“mouseover”, function(){ var color = $(this).css(“background-color”); $(this).css(“background”, “#380606”); $(this).bind(“mouseout”, function(){ $(this).css(“background”, color); }) }) }) 它完美有效,但有可能以更有效的方式做到没有var color = $(this).css(“background-color”); 。 在mouseout之后离开之前的背景颜色并删除#380606 ? 谢谢。