Created
December 7, 2012 08:50
-
-
Save maoyama/4231890 to your computer and use it in GitHub Desktop.
blocklink.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//指定した要素内のリンクを取得して、要素全体をクリック可能にする。 | |
$(function(){ | |
$('.blocklink a').each(function(){ | |
var href = $(this).attr('href'); | |
var target = $(this).attr('target'); | |
$(this).parent().click(function() { | |
if(target){ | |
window.open(href,'_blank'); | |
}else{ | |
document.location = href; | |
} | |
return false; | |
}); | |
$(this).parent().hover(function(){ | |
$(this).css({cursor:'pointer'}); | |
$(this).children('a').css({textDecoration:'underline'}); | |
},function(){ | |
$(this).children('a').css({textDecoration:'none'}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment