在HTML5 Boilerplate中创建的JQuery动画无法在IE9中运行

时间:2013-09-26 06:33:34

标签: jquery html5 internet-explorer-9 boilerplate

我正在使用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)
})
});

提前致谢。

1 个答案:

答案 0 :(得分: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>