Skip to content

Instantly share code, notes, and snippets.

@tao4yu
Last active December 27, 2015 01:38
Show Gist options
  • Select an option

  • Save tao4yu/7246108 to your computer and use it in GitHub Desktop.

Select an option

Save tao4yu/7246108 to your computer and use it in GitHub Desktop.
var flag1= null;
var flag2 = null;
$().ready(function(){
$("*").hover(function () {
if (flag1 != null) {
flag1.removeClass("elemHover");
}
flag1 = $(this);
$(this).addClass("elemHover");
},
function () {
$(this).removeClass("elemHover");
}
);
$('*').bind('mouseover', function () {
if (flag1 != null) {
flag1.removeClass("elemHover");
}
flag1 = $(this);
$(this).addClass("elemHover");
});
$('*').bind('mouseout', function () {
$(this).removeClass("elemHover");
});
$('*').click(function(){
if(flag2 != null){
flag2.removeClass('elemselected');
}
flag2 = $(this);
$(this).addClass('elemselected');
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment