我有一个包含不同产品的清单以及它们的详细信息.默认情况下隐藏详细信息.我想知道如何在悬停时显示列表元素的子元素的详细信息.这是测试它的链接:http://jsfiddle.net/CXrb2/1/
HTML:
<div id="cart-sidebar">
<li>Product 1 <div class="product-details">Productinfo 1</div></li>
<li>Product 2 <div class="product-details">Productinfo 2</div></li>
<li>Product 3 <div class="product-details">Productinfo 3</div></li>
</div>
Run Code Online (Sandbox Code Playgroud)
原型:
$$('.product-details').each(
function (e) {
e.hide();
}
);
$$('#cart-sidebar li').invoke('observe', 'mouseover', function(e) {
// any help would be great :)
});
Run Code Online (Sandbox Code Playgroud) 我的jquery知识上有点(更像是一个非常生锈的).出于某种原因,当绿色的盒子悬停在上面时,我无法弄清楚我在这里错过了什么让蓝色盒子褪色.
剧本:
$(document).ready(function() {
$(".hover-text").hover({
$(".hover-hide").animate({
opacity: 0.4,
}, 500);
});?
Run Code Online (Sandbox Code Playgroud)
html:
<div class="hover-hide">
<div class="hover-text">
BLAH
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
css:
.hover-hide{
width:200px;
height:200px;
background-color:blue;
padding:30px;
}
.hover-text{
color:white;
background-color:green;
padding:10px;
width:auto;
margin-top:20px;
}??
Run Code Online (Sandbox Code Playgroud)
非常感谢!:)
我有需要将html转换为pdf.Html具有跟踪更改细节,如插入下划线和删除删除.当用户将鼠标悬停在任何轨道更改文本上时,他应该能够查看已完成更改的用户名.我们正在使用Aspose dll进行html到pdf转换.
我的投入将是一个很大的帮助.
我有三个div与隐藏的内部div,当你翻转每个div时,它的内部div应该显示,当你推出它时再次隐藏.
例如,我翻转div1,div1内部出现,我推出,div1内部消失.
然而,当我将div1直接从div2移动到div2时,两者都被视为rollout,例如div1 inner消失(应该如此),div2 inner出现(应该如此),但随后div1内部立即消失.
除了为div1 2和3编写单独的函数之外,我不知道该怎么做,任何帮助都非常赞赏!
jsfiddle.net/user1688604/UZpEH/3
var box = $("#box1,#box2,#box3");
var inner = $(".item");
$(box).hover(function() {
$(this).find(inner).stop(true,true).css({"left":"20px"}).animate({"top":"-10px", "opacity": "1"},400);
}, function() {
$(this).find(inner).stop(true,true).animate({"top":"-20px", "opacity": "0"},400, function() {
$(inner).css({"left":"-9999px", "top":"0"});
});
});
<div id="box1">
<div class="item"></div>
</div>
#box1, #box2, #box3 {
width: 300px;
float: left;
margin-right: 20px;
position: relative;
}
.item {
width: 151px;
height: 49px;
padding: 5px 10px 0;
opacity: 0;
position: absolute;
top: 0;
left: -9999px;
}
Run Code Online (Sandbox Code Playgroud) 请查看我使用的JSFiddle:http://jsfiddle.net/txdwg/2/
HTML:
<a href="#">Hover here</a>
<div>Show me now!</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
div {
display:none;
width:100px;
height:100px;
background:red;
margin:20px;
}
a {
font-size:16px;
font-weight:bold;
}
Run Code Online (Sandbox Code Playgroud)
JS:
(function($){
$.fn.hoverDelay = function(over, out, ms){
var delay, ms, that;
ms = ms || 500;
that = this;
that.bind('mouseenter.hoverDelay', function(e){
delay = setTimeout(function(){
over.call(that, e);
}, ms);
}).bind('mouseleave.hoverDelay', function(e){
clearTimeout(delay);
out.call(that, e);
});
};
})(jQuery);
$(function(){
$('a').hoverDelay(function(){
$('div').fadeIn(300);
}, function(){
$('div').fadeOut(300);
}, 300);
});
Run Code Online (Sandbox Code Playgroud)
但是我想通过CSS3来代替JS.我怎样才能使用悬停伪选择器并拥有类似的动画?
我的页面上有一个图标,在500毫秒的延迟后弹出一个带有更多细节的连接盒.
然后,当您从图标和弹出窗口中鼠标拖出时,在500毫秒延迟后,弹出窗口将被隐藏.
我遇到的麻烦是试图阻止隐藏发生是光标在500毫秒延迟期间重新进入图标/弹出窗口.
这是代码......
<div id="accountIcon">
<div id="accountPopup"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
#accountIcon {
position:relative;
height:58px;
width:80px;
cursor:pointer;
background-color:#000;
}
#accountPopup {
position:absolute;
top:58px;
width:400px;
height:200px;
background-color:#CCC;
display:none;
}
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$("#accountIcon").hover(function () {
$("#accountPopup").delay(500).show(0);
}, function () {
$("#accountPopup").delay(500).hide(0);
});
Run Code Online (Sandbox Code Playgroud) 我的情况是这样的:我有2个部分重叠的div,每个都有悬停效果:Div 1 - 包含一个条形图,其中的条形图对悬停有影响.Div 2 - 是一个横跨屏幕底部20%的区域,当用户将鼠标悬停在屏幕底部时(例如靠近屏幕底部),控件从底部向上滑动,以允许它们将全局属性更改为表格.
我希望浏览器能够独立地检测任何一个对象上的悬停,但发生的事情是顶部的任何对象都检测到悬停,但另一个则没有.我发现了一堆几乎相关的问题,但似乎没有回答这个问题.
这是一个原型,所以只能在一个浏览器(最好是Chrome)中工作的hacky答案/答案都可以.使用CSS,jQuery或JS的解决方案也都可以.
编辑:添加了一个小提琴,我认为将说明我的问题:http://jsfiddle.net/Gkgrx/
因此,如果你徘徊在"桌子"的底部(悬停时变成绿色的大红色方块),当我击中导致桌面控制向上滑动的区域(它确实)时,桌子会丢失其悬停状态 - 我想要它还能检测到悬停.
显然我需要在这里剪切和粘贴代码:
CSS:
.controlhover {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
height: 150px;
z-index: 1;
}
.tablecontrol {
position:absolute;
bottom: 0px;
left: 200px;
right: 200px;
background-color: #242D2F;
opacity: .9;
height: 70px;
color: #FFFFFF;
}
.table {
position: absolute;
top: 0px;
left: 50px;
right: 50px;
height: 500px;
background-color: red;
}
.table:hover {
background-color: green;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div class="table">This is a table that does stuff …Run Code Online (Sandbox Code Playgroud) 好吧,我正在制作我的第一个登陆页面,一些不太专业的东西,我希望能够自己制作简单的网页.
所以我的问题是,无论何时单击文本框,文本都会消失.它应该是什么.但是,当用户输入文本时,单击文本框并单击它,该文本将消失.
如何才能使新输入的文本不会消失?
我目前的文本字段代码:
<input type="text" value="Enter Your First Name" id="form"
onblur="javascript:if(this.value=='')this.value='Enter Your First Name';"
onclick="javascript:if(this.value=='Enter Your First Name')this.value='';"
onFocus="this.value=''">
</input></br>
<input type="text" value="Enter Your Email" id="form"
onblur="javascript:if(this.value=='')this.value='Enter Your Email';"
onclick="javascript:if(this.value=='Enter Your Email')this.value='';"
onFocus="this.value=''">
</input></br>
<input type="text" value="Enter Your Phone Number" id="form"
onblur="javascript:if(this.value=='')this.value='Enter Your Phone Number';"
onclick="javascript:if(this.value=='Enter Your Phone Number')this.value='';"
onFocus="this.value=''">
</input></br>
<input type="submit" class="button" name="submit" value=""></input>
Run Code Online (Sandbox Code Playgroud)
我很抱歉没有在这里发布,但我不知道怎么做代码块的事情..
我有一个像这样的简单div ...
<a href="#">
<div class="promo-box promo-1">
<div class="promo-content">
<h2>Heading here</h2>
<p>Text content here.</p>
</div>
</div>
</a>
Run Code Online (Sandbox Code Playgroud)
...允许我在div悬停时更改背景颜色.效果很好,但结果是,我在链接中显示了悬停下划线的文字.我已经尝试了几种方法来定位h2和p,但仍然无法摆脱悬停时的文本修饰.
关于我需要使用什么html元素来应用text-decoration的任何想法:none?
这里的CSS ......
.promo-box
{
text-align:center;
border-radius:5px;
padding:10px;
margin-bottom:20px;
min-height:240px;
}
h2
{
font-family:Lato, Arial, Helvetica, sans-serif;
font-weight:700;
color:#FFF;
font-size:20px;
text-decoration: none;
}
.promo-box p
{
font-family:'Open Sans', Arial, Helvetica, sans-serif;
font-weight:400;
color:#FFF;
font-size:16px;
line-height:16px;
}
.promo-1
{
background-color:#125595;
}
div.promo-1:hover;
}
Run Code Online (Sandbox Code Playgroud) 是否可以在悬停时使用svg多边形形状添加文本?
我的代码是这样的
<svg>
<polygon class="st0" points="0,1.833 638,1.833 383,348.833 0,348.833 "/>
<polygon class="st0" points="0,355.333 649,355.333 891.5,664.833 0,664.833 "/>
<polygon class="st0" points="392.5,348.833 514.75,181.333 645.25,348.833 "/>
<polyline class="st0" points="518.875,174.908 644.667,2.021 1139.833,1.52 1139.75,663.583 897.25,663.583 "/>
</svg>Run Code Online (Sandbox Code Playgroud)
当我检查了很多参考时,只有一个多边形的例子,但在我的代码中,我需要在SVG标签中有4个不同文本的形状.是否可以在悬停时使用多个多边形添加文本?
任何意见,将不胜感激