【问题标题】:JQuery animation created in HTML5 Boilerplate not working in IE9在 HTML5 样板中创建的 JQuery 动画在 IE9 中不起作用
【发布时间】:2013-09-26 06:33:34
【问题描述】:

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

提前致谢。

【问题讨论】:

    标签: jquery html internet-explorer-9 boilerplate


    【解决方案1】:
    // 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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-09
      • 2017-10-10
      • 2011-06-27
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      相关资源
      最近更新 更多