简体   繁体   English

Facebook弹出窗口小部件代码与其他内容冲突(ajax选项卡动态输出)

[英]A facebook pop up widget code conflicts with other content (ajax tabs dynamic output)

Hello after inserting the following code to display facebook pop-up widget inside a tpl file, i had a problem with other content that's not working after inserting this widget I think the jquery.min.js once added to the body of document with the widget that's makes the problem occurs(i have another one included in the header dynamic file,but the widget doesn't appear only if i add it to the body of document-in my case footer.tpl/or detail.tpl) code: 您好,在插入以下代码以在tpl文件中显示facebook弹出窗口小部件之后,您好:在插入此窗口小部件后,其他内容出现问题,我认为jquery.min.js曾经随该窗口小部件添加到文档正文中这导致出现问题(我在头动态文件中包含另一个,但仅当我将其添加到文档正文中时才出现该小部件,在我的情况下为footer.tpl /或detail.tpl)代码:

widget code : 小部件代码

<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>

The other content :(only this code is not giving its dynamic output ( it's using ajax tabs..) 其他内容:(仅此代码不提供其动态输出(它使用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 code (related php code): 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)
jQuery.noConflict();
jQuery(function ($) { jquery code here});

This must stop conflict with jquery and ajax. 这必须停止与jquery和ajax的冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM