您现在的位置:首页 >> 前端 >> 内容

鼠标滑过显示图片+标题的实现

时间:2017/7/14 17:00:20 点击:

  核心提示:function newsLoad() {hits(OBJ_ID, MARK);getHits(OBJ_ID, MARK);getLastArticle();getHistory(MARK);addH...
function newsLoad() {
    hits(OBJ_ID, MARK);
    getHits(OBJ_ID, MARK);
    getLastArticle();
    getHistory(MARK);
    addHistory(OBJ_ID, MARK);
    getNewProduct()
}
getNewProduct() 去掉
function getNewProduct() {
    $.post("/ajax.ashx?action=getnewproduct&t=" + Math.random(), function(a) {
        $("#newpro").html(a);
        $("#newpro h5").mouseover(function() {
            $(this).addClass("cur").siblings("h5").removeClass("cur").end().next("dl").show().siblings("dl").hide()
        }).eq(0).trigger("mouseover")
    })
}

上面一点去掉

在html页面加上下面一段

<script type="text/javascript">
        $.post("" + Math.random(), function(a) {
        $("#newpro h5").mouseover(function() {
            $(this).addClass("cur").siblings("h5").removeClass("cur").end().next("dl").show().siblings("dl").hide()
        }).eq(0).trigger("mouseover")
    })
</script>

前台html

<h5 class=""><a href="http://www.xxxx.com.cn/Products/ldip4909hw.html" title="户外运动无线蓝牙迷你音箱" target="_blank">户外运动无线蓝牙迷你音箱</a></h5>
                <dl style="display: none;">
                    <dt><a href="http://www.xxxx.com.cn/Products/ldip4909hw.html" title="户外运动无线蓝牙迷你音箱" target="_blank"><img src=/uploadfile/2017/0714/20170714050200187.jpg" title="户外运动无线蓝牙迷你音箱" alt="户外运动无线蓝牙迷你音箱"></a></dt>
                    <dd>
                    <ul>
                    </ul>
                    </dd>
                    <p class="clear">
                    </p>
                </dl>

作者:网络 来源:hallwoo