我有一个小但奇怪的问题,我的动画是通过jquery和jquery UI实现的。您可以在下面看到一个简单的工作演示,
当您尝试单击窗帘中的“单击我”,然后在显示的弹出窗口中单击“关闭”时,就会出现问题。您将看到窗帘和图像都上升。你知道为什么吗?
很感谢
$(document).ready(function () {
$('.box_product_image').hover(function () {
$('.box_up-down', this).stop().animate({
bottom: '0px'
}, 300);
$('.box_product_arrow', this).fadeOut(300);
}, function () {
$('.box_up-down', this).stop().animate({
bottom: '-96px'
}, 600);
$('.box_product_arrow', this).fadeIn(300);
});
$(document).on('click', '#text', function () {
$("#dialog").dialog({
height: 200,
width: 200,
modal: true,
closeText: "close"
});
});
});
*, ul, ol {
border: 0 none;
margin: 0;
padding: 0;
}
.box_product_border_image {
border: 1px solid #d9d9d9;
border-radius: 6px;
height: 120px;
overflow: hidden;
width: 150px;
margin: 50px;
}
.box_product_image {
float: left;
height: 120px;
overflow: hidden;
position: relative;
}
.box_up-down {
background-color: rgba(0, 0, 0, 0.8);
bottom: -96px;
height: 100%;
left: 0;
position: absolute;
width: 150px;
}
.box_up-down > * {
color: #fff;
font-size: 11px;
}
.box_product_name {
font-weight: bold;
margin: 3px 0 0 10px;
}
.box_product_arrow {
height: 19px;
position: absolute;
right: 15px;
top: 3px;
width: 10px;
}
.box_product_desc {
margin: 5px 0 0 10px;
}
.box_product_desc ul {
font-size: 10px;
line-height: 10px;
list-style-type: none;
}
.box_product_desc ul li {
margin-bottom: 6px;
}
.box_product_desc ul li a {
color: #fff;
text-decoration: none;
}
#dialog {
background-color: rgba(0,0,0,0.5);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css" rel="stylesheet">
<script src="https://code.jquery.com/ui/1.11.3/jquery-ui.min.js" type="text/javascript"></script>
<div class="box_product_border_image">
<div class="box_product_image">
<img width="150" height="120" src="http://www.microproject.com/wp-content/themes/NybergsMekVerstand/images/img03.png">
<div class="box_up-down">
<div class="box_product_name">Text</div>
<div class="box_product_arrow" style="display: block;">
<img width="10" height="19" title="" alt="" src="http://tpgroupindia.com/images/arrow.png">
</div>
<div class="box_product_desc">
<ul>
<li>
<a href="#">Text</a>
</li>
<li>
<a href="#">Text</a>
</li>
<li>
<a id="text" href="#">Click me</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="dialog"></div>
我稍微重写了您的代码(jQuery,HTML和CSS),看看小提琴。一切邪恶的根源可能是因为链接始终处于焦点..因此单击后可能需要使链接模糊。
http://jsfiddle.net/006L4uof/5/
$('#text').on('click', function(e){
$(this).blur(); //remove focus from clicked link
$('#dialog').dialog({
height: 200,
width: 200,
modal:true,
closeText:"close"
});
});
让我知道它是否无法正常工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句