该网站为hostingcouponsclub.com。我想添加一个文本提示“点击复制和打开网站”的黄色优惠券代码,这是剪刀附近的效果。但是,当我将此代码放到本地环境中时,工具提示不起作用。没问题的。我认为这可能与“点击复制并打开站点”的JavaScript有冲突。我怎么纠正它呢?谢谢。这是工具提示代码:
$(document).ready(function() {
$(".coupon-code").hover(
function() { $(this).contents(".coupontooltip").show(); },
function() { $(this).contents("span:last-child").css({ display: "none" }); }
);
});发布于 2011-01-04 11:57:30
.contents()根本不是这样工作的。你在找$(".coupontooltip", this)和$("span:last-child", this)吗?
发布于 2011-01-04 12:01:18
尝试使用:
function() { $(this).find('.coupontooltip').show(); },
function() { $(this).find('span:last-child').css("display", "none"); }作为hover绑定的参数。
发布于 2011-01-04 12:17:55
尝试使用
$(document).ready(function() {
$(".coupon-code").hover(
function() { $(this).children(".coupontooltip").show(); },
function() { $(this).children("span:last-child").css({ display: "none" }); }
);
});contents()和children()是相同的,只是前者也会获得text和comments节点。
https://stackoverflow.com/questions/4590495
复制相似问题