我使用的是一个名为Viral Gate的脚本,它被用来在有人点击Facebook Like Box后解锁div内的内容,唯一的问题是div在脚本之前出现,所以当页面加载时,它会在脚本呈现之前出现,时间为5秒或更少,具体取决于用户连接,换句话说,如果用户希望他可以在div出现时暂停页面,那么javascript将不会被渲染。 我试图在头部插入脚本,它没有工作,也尝试在adl-inside-gate类之前插入它,结果相同。 这是我的脚本的div和内容一起:Div出现在javascript呈现之前
<div name="likebutton" style="padding-left: 370px; width:200px; padding-top:60px; position:relative;">
<!-- *** ADD THIS CODE AFTER YOUR PUBLIC CONTENT *** -->
<p class="adl-outside-gate">
<div class="adl-inside-gate" style="float:right">
<div class="linkado" style="width:130px; height:60px; background-color:#FF6600; border-width:4px; border-style:dashed; border-color:#FFFF00; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px;"> <a href="#" target="_blank">Clique aqui para visualizar o seu cupom.</a>
</div>
</div>
<div style="float:left"> <b><!-- Sharing buttons --></b>
<!-- Botões -->
<!-- Botões -->
<div>
<div>
<div id="fb-root"> <b><script src="http://connect.facebook.net/pt_BR/all.js#xfbml=1&appId=1667889836683276"></script><fb:like font="" href="http://lucrebem.com.br" layout="box_count" send="false" show_faces="false" width="55"></fb:like></b>
</div>
</div>
</div>
<!-- Botões -->
<!-- Botões --> <b><!-- Here is the code --><script type="text/javascript">
ADL = {};
(function(namespace) {
function ViralGate() { };
ViralGate.prototype.setDisplay = function(className, value) {
var els = document.getElementsByClassName(className);
for (var i = 0; i < els.length; i++) {
els[i].style.display = value;
}
};
ViralGate.prototype.lock = function() {
this.setDisplay('adl-outside-gate', 'block');
this.setDisplay('adl-inside-gate', 'none');
};
ViralGate.prototype.unlock = function() {
this.setDisplay('adl-outside-gate', 'none');
this.setDisplay('adl-inside-gate', 'block');
}
ViralGate.prototype.afterLike = function(event) {
// event is the URL
ADL.viralGate.unlock();
};
namespace.viralGate = new ViralGate();
})(ADL);
ADL.viralGate.lock();
FB.Event.subscribe('edge.create', ADL.viralGate.afterLike);
// Google callback must be in global namespace
afterPlus = function(data) {
ADL.viralGate.afterPlus(data);
}
</script></b>
</div>
听起来像禁用JS会足以总是看到你的内容。 – Bergi 2013-04-29 18:43:47
请给我一个我不知道的答案。 – 023023 2013-04-29 19:10:09
如果你不想让用户看到他们做某个动作,他们应该考虑通过ajax加载它。否则,它将始终处于标记状态。 – 2013-04-29 19:49:05