javascript - The div is a link. When the mouse is moved up, a div will appear, such as a view more button. How to do this?
怪我咯
怪我咯 2017-07-05 10:40:58
0
4
834

p is a link. If you move the mouse up, a p will appear, such as a view more button. How to do this?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(4)
typecho

Just listen to the mouseenter event and then display the p or button

洪涛

Use css for hover

伊谢尔伦
/* 1.css */
.more{display:none};
p:hover .more{display:block}
//2.js
$('p').hover(function(){
$('.more').show();
})

http://jsbin.com/tiqenecata/e...

学霸

html:
<p>

<p class="a">假如我是一个链接</p>
<p class="b">点我查看更多</p>

<p>

js (load jQuery library):

$(function(){

    $(".b").css("display","none");      //初始化隐藏按钮
    $(".a").hover(function(){           //鼠标移入移出函数
        $(".b").css("dispaly","block")  //移入显示
    },function(){    
        $(".b").css("dispaly","none")   //移出隐藏
    })  

})

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template