jq事件和動(dòng)畫(huà)

// $("#show").hide();

$("#btn").get(0).onclick = function(){

// //1.hide

// //$("#show").hide(3000);

// //可以接受一個(gè)回調(diào)函數(shù),當(dāng)動(dòng)畫(huà)執(zhí)行完畢之后就會(huì)觸發(fā)回調(diào)函數(shù)

// $("#show").hide(3000,"swing",function(){

// alert("已經(jīng)完全隱藏");

// });

// //$("#show").hide(3000,);

//2. show

//$("#show").show(1000);

//}

//時(shí)間問(wèn)題? 可以添3個(gè) slow fast normal? ? 慢? 快? 中

// $("#show").hide("fast");

//3.toogle:顯示或者隱藏當(dāng)前元素

//$('#show').toogle(3000);

//4.fadeIn:先顯示元素? 后改變透明度(opactity)升為100%

//$('#show').fadeIn(3000)? 接受三個(gè)參數(shù)

//5.fadeOut:將透明度逐漸將為0,再隱藏

//$('#show').fadeOut(3000)

//6.fadeToogle()有的話就隱藏? 沒(méi)有就顯示

//7.slideDown: 以從上向下滑出來(lái)

//8.slideUp:? 從下往上卷進(jìn)去

//9.slideToogle? 有就卷上去

//10.animate? 3個(gè)參數(shù)

//參數(shù)1.結(jié)束的時(shí)候css 屬性的值

//c參數(shù)2; 時(shí)間? 參數(shù)3:代表的是回調(diào)函數(shù)

//背景色和組合寫(xiě)法不行

// $('#show').animate({

// width:'30px',

//// backgroundColor:"#0000",

//// border:'1px solid black'

// opacity:0.5,

// left:"500px",

// top:"600px"

// },3000,function(){

//

// alert(1);

//

// })

//

//11.stop停止動(dòng)畫(huà)

//$("#show").stop();

//12.delay 延遲執(zhí)行動(dòng)畫(huà)? 如果先執(zhí)行延遲動(dòng)畫(huà)操作? 需要先寫(xiě)延遲代碼

// $("#show").delay(3000);

// $("#show").hide(1000);

//給box下面的son綁定事件

$('#box').on('click','#box',function(){

console.log(11);

})

/*one 方法? 用這個(gè)去綁定的事件 只能執(zhí)行一次

* 刷新頁(yè)面有效

*/

// $('#box').one('click',function(){

// console.log(1111);

// })

}

//移除事件

function handle(){

console.log(1);

}

$('#box').on("click",handle);

$('#box').on("click",function(){console.log(2)})

$('#box').on("mouseover",function(){console.log(3)})

$(document).onkeydown(function(){

//移除單個(gè)

$('#box').off('click',handle);

//移除所有click事件

$("box").off('click');

//移除所有

$("#box").off();

}))

$('#box').on('click',function(){

console.log('box');

});

//實(shí)現(xiàn)不點(diǎn)box的時(shí)候也能執(zhí)行事件回調(diào)函數(shù)

$(document).keydown(function(){

$('#box').trigger('click');

});





$('#box').click(function(event){

console.log(event);

alert(1);

});

$('#box').hover(function(){

console.log(11);

})

// $(window).resize(function(){

// alert(111);

// })

// jq綁定事件第一種方法? 不用考慮兼容問(wèn)題ie8不可以? 能綁定多個(gè)

//

//? $('#box').on('click',function(){

//? alert(12);

//? })

//

//? $('#box').on('click',function(){

//? alert(52);

//? })

//

//2.jq綁定事件的第二種方法

// $("#box").bind("dblclick",function(){

// alert(12);

// })

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容

  • jQuery基礎(chǔ) 什么是JQ?一個(gè)優(yōu)秀的JS庫(kù),大型開(kāi)發(fā)必備JQ的好處?一簡(jiǎn)化JS的復(fù)雜操作二不再需要關(guān)心兼容性三...
    幺七閱讀 956評(píng)論 0 2
  • 一、hide()、show()、toggle() //1.hide():在HTML文檔中,為一個(gè)元素調(diào)用hide(...
    空谷悠閱讀 583評(píng)論 0 0
  • 1.說(shuō)說(shuō)庫(kù)和框架的區(qū)別? 庫(kù):用來(lái)提供一些方法的集合,避免重復(fù)定義相同功能的函數(shù)并具有一定的模式兼容性, 框架,規(guī)...
    candy252324閱讀 302評(píng)論 0 0
  • 題目1: jQuery 能做什么? 方便快捷獲取DOM元素如果使用純JavaScript的方式來(lái)遍歷DOM以及查找...
    Taaaaaaaurus閱讀 314評(píng)論 0 1
  • 選擇器選擇器是jQuery的核心。 事件 動(dòng)畫(huà) 擴(kuò)展
    wyude閱讀 490評(píng)論 0 1