/* 看板娘 */
/* 粒子吸附*/
一、阻止后续事件执行
$('#d1').click(function (e) {
alert(123)
// 1.阻止该标签后续事件的执行 方式1 推荐
// return false
// 2.阻止该标签后续事件的执行 方式2 了解
// e.preventDefault()
})
二、阻止事件冒泡

$('#d1').click(function (e) {
alert(123)
// 1.阻止该标签后续事件的执行 方式1 推荐
// return false
// 2.阻止该标签后续事件的执行 方式2 了解
// e.preventDefault()
})
三、文档加载
// 原生js文档加载方式
window.onload = function () {}
// jQuery文档加载方式01
$(document).ready(function () {})
// jQuery文档加载方式02
$(function(){})
四、事件委托


五、动画效果
$("#d1").on("click", function () {
var newI = document.createElement("i");
newI.innerText = "+1";
$(this).append(newI);
$(this).children("i").animate({
opacity: 0
}, 1000)
})
posted @
2022-02-16 20:27
红绿灯的黄呀
阅读(
34)
评论()
收藏
举报