0

我正在使用 HTML5 Boilerplate 模板开发一个站点,并使用 JQuery 创建了鼠标悬停效果。它在 IE8、Firefox 和 chrome 中运行良好。但在 IE9 和 IE10 中没有。在http://jsfiddle.net/sr77in/TGzsf/2/中找到代码和工作示例

$(document).ready(function(){
$('.infoimg').hover(function(){
$('.infodata',this).stop().animate({bottom: '0px'}, 500)
}, function(){
$('.infodata',this).stop().animate({bottom: '-50px'}, 500)
})
});

提前致谢。

4

1 回答 1

0
// please paste this code in your blank html and after run this. (working for me)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>My Document</title>
<style>
.destcont {
    height: 190px;
    width: 200px;
    overflow: hidden;
    margin: 5px 21px 10px 0px;
    float: left;
    display: inline-block;
}
.infoimg {
    height: 100%;
    width: 100%;
    position: relative;
}
.item-arrow {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 2002;
    background: url(../img/arrow-black.png) no-repeat;
    display: inline-block;
    width: 11px;
    height: 18px;
}
.infoimg img {
    position: absolute;
    z-index: 600;
}
.infoimg span.imgtitle {
    position: absolute;
    z-index: 700;
    padding: 10px;
    color: #ffffff;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: bolder;
}
.infoimg span.frotitle {
    position: absolute;
    z-index: 701;
    padding: 10px;
    color: #ffffff;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: normal;
}
.infoimg span.totitle {
    position: absolute;
    z-index: 702;
    padding: 25px 10px;
    color: #ffffff;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: bolder;
}
.infodata {
    font: 11px arial;
    color: #fff;
    position: absolute;
    bottom: -50px;
    width: 100%;
    text-align: left;
    background: #97c524;
    height: 100px;
    z-index: 1200;
    padding: 3px;
}
.infodata span {
    display: block;
}
.btngroup {
    margin-top: 20px;
    display: block;
    text-align: center;
}
.infostrong {
    font-size: 15px;
    text-transform: uppercase;
    font-weight: bolder;
}
.infotagline {
    font-size: 12px;
    text-transform: uppercase;
}
.btngroup input {
    background: #4d4d4d;
    color: #ffffff;
    padding: 10px 20px;
    border: 0px;
    margin: 0px 4px;
}
</style>
<script src="http://code.jquery.com/jquery-1.10.1.js"></script>
<script>
    $(document).ready(function(){
        $('.infoimg').hover(function(){
            $('.infodata',this).stop().animate({bottom: '0px'}, 500)
        }, function(){
            $('.infodata',this).stop().animate({bottom: '-50px'}, 500)
        });
    });
</script>
</head>

<body>
<div class="destcont">
  <div class="infoimg"> <img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRxa-zEPDs_ZBXXs4CzyjKGBP72anROtXaoV0kI1_L2kqAorrs30Q">
    <div class="infodata"> <span class="infostrong">sr77in</span> <span class="infotagline">Kerala-Gods own country</span>
      <div class="btngroup">
        <input type="button" value = "CITY GUIDE">
      </div>
    </div>
  </div>
</div>
</body>
</html>
于 2013-09-26T07:00:37.123 回答