Django 用户认证 用户 邮箱登录 邮箱注册 ORM or,and,not form.py FORM ModelForm Paginator 分页 HTMl JQuery 定位元素 ajax django切片 restfulapi 跨域 Ubantu Python Mysql Scrapy 爬虫 导出 Python读写 Pycharm 破解 session re sqlit3 生成式 其他 Prism 富文本 CSS Nginx 部署 请求头 抓包 协议 selenium Ubuntu 宝塔 AI Comfy-ui ollama dify open-webui Git docker
jQuery鼠标移动事件
张建行 2022年1月28日 04:10 54 文章标签: JQuery 定位元素 CSS

通过jQuery检测鼠标事件实现不同的效果,

hover 可以执行两个操作,第一个函数是鼠标移入事件,第二个函数是鼠标移出事件,$(this)表示当前检测到的标签,可以对其进行添加class,或者设置css样式等操作

$('.card').hover(function () {
        $(this).addClass('shadow')
        $(this).find('a').css('color', '#FE4F70')
        $(this).find('a').css('transition', 'all .2s ease-in-out')
    },
    function () {
        $(this).removeClass('shadow')
        $(this).find('a').css('color', '#203656')
        $(this).find('a').css('transition', 'all .2s ease-in-out')

    }
)