Hello插入以下代码后显示tpl文件中的facebook弹出窗口小部件,我插入此窗口小部件时其他内容无效 我认为jquery.min.js曾经添加到文档正文中,其中的小部件会导致问题发生(我有另一个包含在标题动态文件中,但是只有当我将它添加到正文中时才会出现小部件文件 - 在我的案例中footer.tpl /或detail.tpl) 代码:
小部件代码:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
{literal}
<script type='text/javascript'>
//<![CDATA[
jQuery.cookie = function (key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = jQuery.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
//]]>
</script>
<script type='text/javascript'>
jQuery(document).ready(function($){
if($.cookie('popup_user_login') != 'yes'){
$('#fanback').delay('0').fadeIn('medium');
$('#fanclose, #fan-exit').click(function(){
$('#fanback').stop().fadeOut('medium');
});
}
});
</script>{/literal}
<div id='fanback'>
<div id='fan-exit'>
</div>
<div id='fanbox'>
<div id='fanclose'>
</div>
<div class='remove-borda'>
</div>
<iframe allowtransparency='true' frameborder='0' scrolling='no' src='//www.facebook.com/plugins/likebox.php?
href=http://www.facebook.com/ethiobesttubefans&width=402&height=255&colorscheme=dark&show_faces=true&show_border=false&stream=false&header=false'
style='border: none; overflow: hidden; margin-top: -19px; width: 402px; height: 230px;'></iframe><center>
<span class="#h2_song" >Like Ethiobest Tube Community, Thanks!</span></center>
</div>
</div>
其他内容:(只有这段代码没有提供动态输出(它使用的是ajax标签..)
<div id="tabs_related" class="tabcontent">
{$show_more_related}
</div>
<div id="tabs_sameartist" class="tabcontent">
{$show_more_artist}
</div>
<div id="tabs_other" class="tabcontent">
{$show_more_best}
</div>
</div>
</div>
Ajax.php代码(相关的php代码):
case 'detail':
$video_id = $_GET['vid'];
$video_id = str_replace($illegal_chars, "", $video_id);
$video = request_video($video_id, '', true);
$embed_code = '';
if ( ! is_array($video))
{
exit();
}
switch ($action)
{
case 'show_more_best':
$output = show_more('best_in_category', $video['category'], 10);
break;
case 'show_more_artist':
$output = show_more('same_artist', $video['artist'], 10);
break;
case 'show_more_related':
$output = show_more('related', $video['category'], 10);
break;
}
echo $output;
break;
default:
exit();
break;
} // end switch ($page)
答案 0 :(得分:0)
jQuery.noConflict();
jQuery(function ($) { jquery code here});
这必须停止与jquery和ajax的冲突。