亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

請問這是什么問題,是事件冒泡造成的嗎?

//添加jQuery模塊依賴

require.config({//require自帶config方法可以把文件名和映射的模塊名相關聯

paths:{jquery:'jquery.min',

jqueryUI:'jquery-ui.min'

}

});

require(['jquery','window'],function($,w){

$("#a").click(function(){

var win=new w.Window().alert({

title:"提示",

content:"welcome!",

handler:function(){

alert("You click the button");

},

width:300,

height:150,

y:50,

hasCloseBtn:true,

text4AlertBtn:"OK",

dragHandle:".window_header",

skinClassName:"window_skin_a",

handler4AlertBtn:function(){

alert("you click the alert button");

},

handler4CloseBtn:function(){

alert("you click the close button");

}

}).on("alert",function(){

alert("the second alert handler");

}).on("close",function(){

alert("the second close handler");

});

win.on("alert",function(){

alert("the third alert handler");

});

});

});

如上述代碼瑣示,除了自己加了皮膚skinClassName這個參數外其余和老師一模一樣

問題出現在:

handler4AlertBtn:function(){

alert("you click the alert button");

},

handler4CloseBtn:function(){

alert("you click the close button");

}

當點擊alert(OK按鈕)時,出現了:you click the alert button ,you click the alert button,the second alert handler,the third alert handler看似和老師的一樣但是明顯的是you click the alert button多出現了1次,同樣當點擊關閉(close)按鈕時也出現了:you click the close button,you click the close button,the second close handler即多出現了一次you click the close button,請問是什么原因?

正在回答

1 回答

調用了兩次



0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
阿當大話西游之WEB組件
  • 參與學習       26365    人
  • 解答問題       278    個

衡量攻城師能力是否成熟的重要指標,本課程會以彈窗組件為例

進入課程

請問這是什么問題,是事件冒泡造成的嗎?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號