【发布时间】:2017-01-04 04:38:14
【问题描述】:
我有一个简单的设置:一个图像,然后是一个带有一些隐藏信息的段落,然后在鼠标悬停时向上滑动到图像上。如果我尝试在段落上应用虚线或虚线的边框顶部,它只会变成一条实线。这是修复的已知问题吗?我什至尝试通过 jQuery 添加虚线边框,它仍然显示为实线。
HTML:
<div class="wrap">
<img src="images/fillertxt.jpg" alt="image" />
<img src="images/filler.jpg" class="front" alt="image" />
<p class="info">
This is a short description with a bit of text.
</p>
</div>
CSS:
.wrap .info {
width:204px;
height:50px;
background:url(images/infobg.jpg) repeat-x #8d9c0c;
color:#f7f5ef;
padding:3px;
position:absolute;
top:142px;
left:0;
border-top:3px dotted #8d9c0c;
}
JS:
$(document).ready(function(){
$("p.info").css("border-top","3px dotted #8d9c0c");
$(function(){
bindTypeOne();
$("input[type=radio]").click(function(){
if ($(this).attr("rel") == "type1"){
bindTypeOne();
} else if ($(this).attr("rel") == "type2"){
bindTypeTwo();
}
});
});
function bindTypeOne() {
$("div.wrap").hover(function(){
$(this).children("p.info").stop();
$(this).children(".front").stop().animate({"top":"141px"}, 400);
},function(){
$(this).children("p.info").stop();
$(this).children(".front").stop().animate({"top":"0"}, 700);
});
};
function bindTypeTwo() {
$("div.wrap").hover(function(){
$(this).children(".front").stop();
$(this).children("p.info").stop().animate({"top":"80px","border-top":"3px dotted #8d9c0c"}, 400);
},function(){
$(this).children(".front").stop();
$(this).children("p.info").stop().animate({"top":"142px"}, 700);
});
};
});
【问题讨论】:
-
能否提供代码和CSS?
-
您也可以发布您的 jQuery 代码(通过编辑您的帖子)吗?