p is a link. If you move the mouse up, a p will appear, such as a view more button. How to do this?
typecho2017-07-05 10:42:58
Just listen to the mouseenter event and then display the p or button
伊谢尔伦2017-07-05 10:42:58
/* 1.css */
.more{display:none};
p:hover .more{display:block}
//2.js
$('p').hover(function(){
$('.more').show();
})
http://jsbin.com/tiqenecata/e...
欧阳克2017-07-05 10:42:58
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") //移出隐藏
})
})