jQuery 点击事件响应 自己写的 $(function(){}) 没有绑定成功
<scriptlanguage="javascript"type="text/javascript">$.fn.greate=function(){this.css({"...
<script language="javascript" type="text/javascript">
$.fn.greate = function(){
this.css({
"background-color":"red",
"height":"10px",
"width":"10px",
"position":"relative"
}
);
}
$(function(){
$(".fly").animate({'left':'200'},500).greate()
})
$(function(){
$('#mont').click().parent().append('<div class="fly"></div>')
})
</script>
===============================
<style>
#mont{ width:30px; height:30px; background-color:#333;
position:relative}
</style>
===============================
<div id="mont"></div>
为什么我每一次点击 #mont 之后 生成的 .fly 没有绑定之前写的 greate() 展开
$.fn.greate = function(){
this.css({
"background-color":"red",
"height":"10px",
"width":"10px",
"position":"relative"
}
);
}
$(function(){
$(".fly").animate({'left':'200'},500).greate()
})
$(function(){
$('#mont').click().parent().append('<div class="fly"></div>')
})
</script>
===============================
<style>
#mont{ width:30px; height:30px; background-color:#333;
position:relative}
</style>
===============================
<div id="mont"></div>
为什么我每一次点击 #mont 之后 生成的 .fly 没有绑定之前写的 greate() 展开
2个回答
展开全部
$.fn.greate = function () {
this.css({
"background-color": "red",
"height": "10px",
"width": "10px",
"position": "relative"
});
}
$(function () {
$('#mont').click(function () {
var fly = $('<div class="fly"></div>');
$(this).parent().append(fly)
// 添加fly之后执行animate
fly.animate({'left': '200'}, 500).greate()
})
})
你是不想要这个效果呢?
TableDI
2024-07-18 广告
2024-07-18 广告
VLOOKUP 是 Excel 中一个非常实用的函数,它允许用户在一个区域或表格的首列中查找特定值,并返回同一行中指定列中的值。当进行跨表匹配时,你可以使用 VLOOKUP 函数将两个不同表格中的数据关联起来。通过指定查找值、表格数组、列号...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询