JQuery------实现鼠标摁下抬起时div背景色改变

作用:使用自定义一个按钮

代码:

<div class = 'btn'>按钮</div>

$(".btn").mousedown(function () {   $(this).css({ "backgroundColor": "#aaa" }); }).mouseup(function () {   $(this).css({ "backgroundColor": "#ccc" }); }); });

 

posted @ 2017-02-07 13:58  玉天恒  阅读(2302)  评论(0)    收藏  举报