0
ApplyClickableLinkToClass = function(selectedElements) {
// Go through each of the passed in selections and try to apply a link to them
$.each(selectedElements, function() {
var linkElement = $("a:first:not(.do-not-apply-clickable-link)", $(this));
var link = linkElement.attr("href");
if (!IsNullEmptyOrUndefined(link)) {
$(this).click(function(firstLink) {
var divToLink = firstLink;
return function() {
$(divToLink).unbind('click');
if (divToLink.attr("target") != "_blank") {
window.location = link;
return false;
}
};
}(linkElement));
}
});
我认为这将在新窗口中打开目标,并删除点击事件,但调用的时候什么都不做,什么想法?
如下调用
var clickable = function() {
ApplyClickableLinkToClass($j(".rc_blueBtn, .rc_whiteBtn:not(.More)"));
};
setTimeout(clickable, 2000);
关于同一段代码的三个问题。看起来很有趣。 – 2012-03-15 21:53:32
162个问题和5个答案......虽然没有必要回答其他人的问题,但作为一个社区的一部分是一种付出和承担。我建议给予更多一点.. – 2012-03-15 21:56:37
“a:第一:没有(.do-not-apply-clickable-link)”只是不适合我。 “a:不是(.do-not-apply-clickable-link):第一个”应该没问题。 – 2012-03-15 22:36:22