// $("#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);
// })