前端面试题_知识点复习

后续不断增加~~~

jQuery

区别mouseover与mouseenter?

  • mouseover: 在移入子元素时 也会触发, 对应mouseout
  • mouseenter: 只在移入当前元素时才触发, 对应mouseleave
  • hover()使用的就是mouseenter()和mouseleave()

区别on(‘eventName’, fun)与eventName(fun)

  • on('eventName', fun): 通用, 但编码麻烦
  • eventName(fun): 编码简单, 但有的事件没有对应的方法
<script type="text/javascript">
    $('.div1')
        .mouseover(function () {
            console.log('mouseover 进入')
        })
        .mouseout(function () {
            console.log('mouseout 离开')
        })

    $('.div3')
        .mouseenter(function () {
            console.log('mouseenter 进入')
        })
        .mouseleave(function () {
            console.log('mouseleave 离开')
        })
</script>

效果展示
这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值