【发布时间】:2014-05-10 07:12:48
【问题描述】:
这是我用于显示隐藏 div 的 html 和脚本代码。在 google chrome 中不工作,但在 Firefox 和 ie8 中工作正常我现在能做什么?请检查我共享的代码。隐藏();显示();功能无法正常工作。
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-1.9.1.min.js"></script>
<style>
.tab-container /* this is the css code for the tabs*/
{
float:left;
width:30%;
//border:1px solid #147D36;
//border-left:4px solid #147D36;
margin-left:1.5%;
margin-right:1.5%;
}
.tab-text /* this is the div for the text that is coming on hover*/
{
width:97%;
margin-left:3%;
float:left;
background:#fff;
opacity:0.5;
color:#1B6298;
margin-top:-65px;
z-index:999999;
/*display:none;*/
}
.tab-title/* this is the div for the text title that is coming on hover*/
{
float:left;
width:100%;
font-weight:bold;
font-size:18px;
padding-top:17px;
}
.tab-content/* this is the div for the text content that is coming on hover*/
{
float:left;
width:30%;
float:right;
font-size:12px;
padding-bottom:10px;
}
</style>
<!--this is my html code-->
<div class="tab-container">
<img src="images/ourmission.png" width="100%">
<div class="tab-text">
<div class="tab-title">Our Mission</div>
<div class="tab-content">read more</div>
</div>
</div>
<div class="tab-container">
<img src="images/ourfinincial.png" width="100%">
<div class="tab-text">
<div class="tab-title">Our Financial</div>
<div class="tab-content">read more</div>
</div>
</div>
<div class="tab-container">
<img src="images/ourgoals.png" width="100%">
<div class="tab-text">
<div class="tab-title">Our Team</div>
<div class="tab-content">read more</div>
</div>
</div>
<script>
/*jquery code for the show and hide function on hover-scripting code */
$(document).ready(function() {
$('.tab-text').hide();
$('.tab-container').hover(function() {
$(this).find('.tab-text').show();
}, function() {
$('.tab-text').hide();
});
});
</script>
【问题讨论】:
-
HTML 和 CSS 代码好吗?你能创建fiddle吗?
-
你用的是什么版本的jQuery?
标签: jquery html css google-chrome firefox