jquery hover hasClass insertBefore live blockUI children notice

hover

 

    $(".onenote").hover(function(e) {
        $(this).children(".newnote_right_icon").removeClass("div_beHidden");
        e.stopPropagation();

    }, function() {
        $(this).children(".newnote_right_icon").addClass("div_beHidden");
    });

 

hasClass

    $(".onenote").click(function() {
        var obj = $(this).parent().children(".addCommentDiv")[0];
        if ($(obj).hasClass("div_beHidden")) {
            $(obj).removeClass("div_beHidden");
        } else {
            $(obj).addClass("div_beHidden");
        }
    });

live  和直接click的区别是以后新添加的元素也会受影响

    $(".deleteComment").live("click",function(e){
        $(this).parent().parent().parent().remove();
        e.stopPropagation();
    });

 

hover的live写法

    $(".onecomment").live('hover',function (ev) {
            if (ev.type == 'mouseover') {
                $(this).children().children(".right").removeClass("div_beHidden");
            }
            if (ev.type == 'mouseout') {
                $(this).children().children(".right").addClass("div_beHidden");
            }
    });
 

 

 

insertBefore

    $(".submitCommit").click(function() {
        $('.CommitTemplate').clone().removeClass("div_beHidden").removeClass("CommitTemplate").insertBefore($(this).parent().parent().parent());
        $(this).parent().parent().parent().addClass("div_beHidden");
    });
 

blockUI

    <script type="text/javascript" src="jquery/blockui/jquery.blockUI.js"></script>


	openWaitBlock();
	$.post(url,params,function(data){
		closeWaitBlock();
		if(data.status=="1"){
			parent.$.fn.ceebox.closebox();
			alert("Your message was sent successfully.");
		}else if(data.status=="-1"){
			$("body").html("The session time out.");
		}else if(data.status=="0"){
			$("body").html("Error");
		}
	},"json");
 

 

function openWaitBlock(message, timeout){
	if(!message){
		message = "<div style='font-size: 20px; float: right;'><img src='images/ajax-loader.gif'/></div>";
	}			
	$.blockUI({ css: { 
		            border: 'none', 
		            padding: '15px', 
		            backgroundColor: '', 
		            '-webkit-border-radius': '10px', 
		            '-moz-border-radius': '10px', 
		            opacity: .5, 
		            color: '#fff',
		            width: '15%'
	          	},
	          	message:message
	});
	if(timeout){
		setTimeout($.unblockUI, timeout); 
	}
}
 

find children

 

$("#myjobpost_status_list>li.wh>span")

copyTR.children().children("b.name").attr("onClick","checkCandidates("+list[i].rojid+");");
copyTR.find("b>img.isCheck").attr("src","images3/checked.png");
copyTR.find("b.name")
 

 

 

notice   jquery.notice.js

 

function notice(data){
	  if(data != null && data.length >0 ){
	   jQuery.noticeAdd({
		text: data
     });
	}
}
 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(jquery)