标签: hover

当一个人徘徊时,jQuery褪色/调暗其他列表元素,我90%那里..?

我有一个无序列表,可能有30个项目.当其中一个项目悬停时,其余列表项目淡化为30%,悬停项目保持在100%; 当你离开列表时,它们都会逐渐消失至100%并且我已经设置了这个.

当您从一个项目移动到另一个项目时,我的问题就会出现,其他列表项目会逐渐淡化为100%,然后再降低到30%.除非用户离开整个列表,否则我希望它们保持在30%.

我在每个列表项上使用hoverIntent插件.我还使用jQuery将一个类添加到当前列表项中,因此我可以淡化其余的并在您离开后将其删除.我使用了jQuery Cookbook网站上的等待函数(http://docs.jquery.com/Cookbook/wait)

你明白我的意思吗?

到目前为止,这是我的代码:

$.fn.wait = function(time, type) {
    time = time || 300;
    type = type || "fx";
    return this.queue(type, function() {
        var self = this;
        setTimeout(function() {
            $(self).dequeue();
        }, time);
    });
};

$("#sites li:not(#sites li li)").hoverIntent(function(){
    $(this).attr('class', 'current'); // Add class .current
    $("#sites li:not(#sites li.current,#sites li li)").fadeTo("slow", 0.3); // Fade other items to 30%
    },function(){
    $("#sites li:not(#sites li.current,#sites li li)").wait().fadeTo(600, 1.0); // This should set the other's opacity back to 100% on mouseout …
Run Code Online (Sandbox Code Playgroud)

jquery fade hover wait

2
推荐指数
1
解决办法
7164
查看次数

在悬停时显示特定的div?仅使用css和html

我希望在光标悬停在锚标记上时div使用类dikha 显示第二个(在HTML中).

HTML代码:

<a>Hover over me!</a>
<div class="faraz"> sdjfg </div>
<div class="dikha">Stuff shown on hover</div>
Run Code Online (Sandbox Code Playgroud)

样式

div {
display: none;
}

a:hover > div:nth-child(2) {
display: block;
background-color: RED;
height: 250px;
width: 960px;
}
Run Code Online (Sandbox Code Playgroud)

css html5 hover css3

2
推荐指数
1
解决办法
8414
查看次数

CSS hover禁用嵌套表

我有CSS :hover类的问题.如何禁用:hover第二行内的第二个表类.

这是小提琴

HTML

<table border="0" width="100%" id="product-table">
  <tr>
    <td colspan="2">Title of the table</td>
  </tr>
  <tr>
    <td width="20%"><b>Text text</b></td>
    <td>someting about product</td>
  </tr>
  <tr>
    <td><b>text text</b></td>
    <td>
        <table border="0" width="100%">
        <thead>
            <tr bgcolor="#ddd">
                <td colspan="6"><strong>Title of inside</strong></td>
            </tr>
            <tr bgcolor="#efefef">
                <td width="20%"><strong>No</strong></td>
                <td width="20%"><strong>Date</strong></td>
                <td width="20%"><strong>Define</strong></td>
            </tr>
        </thead>
        <tbody id="hat_ekle">
            <tr>
                <td>123</td>
                <td>2013</td>
                <td>some text</td>
            </tr>
            <tr>
                <td>234</td>
                <td>2013</td>
                <td>some text</td>
            </tr>
        </tbody>
        </table>
    </td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

CSS

#product-table tr:hover { background:#333; }
Run Code Online (Sandbox Code Playgroud)

html css hover

2
推荐指数
1
解决办法
1517
查看次数

如何为图像标记悬停

我有一些图片作为链接,我想给他们悬停效果,所以在悬停时,他们会出现一个播放按钮.为此,我创建了一个类并为悬停提供了一个背景img,但它不起作用.

.img:hover {
background:url(http://i40.tinypic.com/i3s4dc.png);
}
Run Code Online (Sandbox Code Playgroud)

这就是我所做的:http://jsfiddle.net/nkEpd/

html css image hover css3

2
推荐指数
1
解决办法
8964
查看次数

光标无法在a:hover中工作

我遇到了一些问题.我正在尝试为鼠标悬停在链接上时设置自定义光标.我正在尝试使用此代码,但没有任何反应,它仍然是指针.

a {
    color: #99ccff;
    cursor: paw.cur;
}

a:hover {
    color: #71b2f4;
    cursor: paw.cur;
}
Run Code Online (Sandbox Code Playgroud)

即使添加!important到a:hover的结尾也不起作用.

css cursor hover

2
推荐指数
1
解决办法
1535
查看次数

使用JointJS检测悬停

我正在使用JointJS API绘制一个内部带有嵌入路径的矩形.

这个路径作为一个按钮,我想只有当矩形悬停时才能看到这个按钮,但我无法想象如何使用JointJS检测悬停在父元素上...是否有任何编程方式来检测它?谢谢.

hover jointjs

2
推荐指数
1
解决办法
2854
查看次数

让悬停留下来,直到下一个链接

首先,我只是想说我不是一个程序员,但我正在尝试复制一个代码,因为我的javascript不是最好的,我失败了.

我尝试复制的css/java/wtv中的"动画"来自本网站上的3个第一个框链接:http: //artcom.de

正如您在悬停盒子/链接时所看到的那样,它会一直悬停,直到鼠标移过另一个链接.

我找到了一些javascript的解决方案,包含动画并使用一个.stop().animate(函数,但这使得无法在它上面编写css,其中一个东西是在不同的链接时放置不同的背景图像(我可以让我只是不能把盒子悬停到下一个链接).

如果你发现我的问题很大的请求随时不回答.这是我的第一篇文章,因为编码是我开始的事情,我觉得有点紧张地问这个问题.

提前感谢您的回复.

html javascript css jquery hover

2
推荐指数
1
解决办法
2884
查看次数

如何禁用CSS:悬停在媒体查询中?

我有一个悬停效果,我只想在视口的最小宽度为900px时触发.我希望在视口较小时禁用悬停效果.

我该怎么做呢?

PS:我正在使用Sass(SCSS),这可能会有所帮助.

这是我想要禁用的悬停效果的一小部分.它用于缩放图像

img {
    display: table-cell;
    width: 100%;
    max-width: $painting-max-width;
    max-height: $painting-max-height;

    margin: auto;

    // zoom in animation transition
    transition: $painting-zoom-delay;
    transition-timing-function: cubic-bezier(0.25,0.46,0.45,0.94) 0s;

    &:hover {
        max-width: $painting-zoom-size;
        max-height: $painting-zoom-size;
    }

}
Run Code Online (Sandbox Code Playgroud)

css hover responsive-design

2
推荐指数
1
解决办法
1万
查看次数

仅使用CSS将悬停效果应用于图像的非透明部分

题:

确保CSS悬停效果仅应用于不透明的复杂图像部分的最简单/最佳方法是什么?

我有一个svg,其中的部件是透明的,但是,悬停效果将应用于整个svg的矩形区域.

代码片段:

#bear {
  width: 150px;
  background-color: red;
}
#bear:hover + #bearBox {
  background: green;
}
#bearBox {
  position: absolute;
  background: red;
}
Run Code Online (Sandbox Code Playgroud)
<img id="bear" src="http://www.clipartbest.com/cliparts/4Tb/o5d/4Tbo5dxEc.svg">
<p id="bearBox">Touching Bear</p>
Run Code Online (Sandbox Code Playgroud)

在上面的代码片段中,要求是:hover状态仅通过悬停熊而不是整个img元素(背景设置为红色以用于说明目的)来触发.


CodePen:http://codepen.io/cbbcbail/pen/kkVPqK

html css svg image hover

2
推荐指数
1
解决办法
1051
查看次数

css不透明度转换不起作用

对于一个网站,我想在一张桌子上显示一些图片,但因为其中一些是股票照片,所以我需要一个来源.我希望在用户将鼠标悬停在图片上时显示源.所以我把源标签放在一个类(.PicSource)中并给它{opacity 0; 转换所有.2s轻松}并悬停在图片上(.ServPic).ServPic:hover + .PicSource {opacity:1}.但它没有显示源文本,我不知道为什么.其他悬停事件工作正常.我在悬停时使用相同的东西来隐藏Caption,并且一切都很好.

所以这里是一个示例代码(它应该将.PicSource的不透明度更改为1,但它不会,所以你可以手动更改它以查看它)

.ServPic {
  width: 350px;
  height: 275px;
  opacity: 0.5;
  transition: opacity .2s ease-in;
}

.PicCapt {
  position: absolute;
  top: 0px;
  left: 0px;
  opacity: 1;
  transition: opacity .2s ease-in;
}

.PicSource {
  position: absolute;
  top: 0%;
  left: 20%;
  opacity: 0;
  color : #000000;
  transition: all .2s ease-in;
}

.ServPic:hover {
  opacity: 1;
}

.ServPic:hover+.PicCapt {
  opacity: 0;
}

.ServPic:hover+.PicSource {
  opacity: 1;
}
Run Code Online (Sandbox Code Playgroud)
<table>
  <tr>
    <td>
      <div>
        <img class="ServPic" src="https://cdn.lrb.co.uk/blog/wp-content/uploads/2014/03/Lorem_Ipsum.jpg">
        <a class="PicCapt">CAPTION</a>
        <a class="PicSource">SOURCE.COM</a>
      </div> …
Run Code Online (Sandbox Code Playgroud)

html css hover opacity

2
推荐指数
1
解决办法
87
查看次数

标签 统计

hover ×10

css ×8

html ×5

css3 ×2

image ×2

jquery ×2

cursor ×1

fade ×1

html5 ×1

javascript ×1

jointjs ×1

opacity ×1

responsive-design ×1

svg ×1

wait ×1