MyBB Community Forums

Full Version: Problem Add Code To Headerinclude
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi to All,

I try to add this code in the template headerinclude:

<script src="{$mybb->settings['bburl']}/jscripts/facebox/lib/query.js" type="text/javascript"></script>
<link href="{$mybb->settings['bburl']}/jscripts/facebox/src/facebox.css" media="screen" rel="stylesheet" type="text/css"/>
<script src="{$mybb->settings['bburl']}/jscripts/facebox/src/facebox.js" type="text/javascript"></script>
<script type="text/javascript">$.noConflict();jQuery(document).ready(function($) {$('a[rel*=facebox]').facebox() })</script>

But I am getting this error

[Image: YqPHp.png]

This is my headerinclude:

<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/prototype.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/general.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1600"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> 
{$stylesheets}
<script type="text/javascript">
/**
 * Modal Boxes JS
 *
 * @author Euan T. <[email protected]>
 * @version 1.0.0
 */

jQuery.noConflict();

jQuery(document).ready(function($)
{
    // Make the jQuery modal login redirect you back to the page you're currently on //
    $('#loginModal input[name="url"]').attr("value", window.location);
    // /Login redirect //

    // Modal Boxes //
    $('a[name="modal"]').on('click', function(event)
    {
        event.preventDefault();
        
        var target = $(this).attr('rel');
        
        // Set up the shadowing
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
        $('#mask').css({'width': maskWidth, 'height': maskHeight});
        $('#mask').fadeIn(1000);    
        $('#mask').fadeTo("slow", 0.8);  
        
        // Position the actual modal
        var winH = $(window).height();
        var winW = $(window).width();
        $(target).css('top',  (winH / 2) - ($(target).height() / 2));
        $(target).css('left', (winW / 2) - ($(target).width() / 2));
        $(target).fadeIn(2000); 
    });
    
    $('.modalBox a[rel="closeModal"]').on('click', function(event)
    {
        event.preventDefault();
        $('#mask, .modalBox').hide();
    }); 
    
    $('#mask').on('click', function ()
    {
        $(this).hide();
        $('.modalBox').hide();
    }); 
    // /Modal Boxes //
});
</script> 
<script type="text/javascript">
<!--
	var cookieDomain = "{$mybb->settings['cookiedomain']}";
	var cookiePath = "{$mybb->settings['cookiepath']}";
	var cookiePrefix = "{$mybb->settings['cookieprefix']}";
	var deleteevent_confirm = "{$lang->deleteevent_confirm}";
	var removeattach_confirm = "{$lang->removeattach_confirm}";
	var loading_text = '{$lang->ajax_loading}';
	var saving_changes = '{$lang->saving_changes}';
	var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
	var my_post_key = "{$mybb->post_code}";
	var imagepath = "{$theme['imgdir']}";
// -->
</script>
{$newpmmsg}
In above code, find;
<script type="text/javascript">$.noConflict();jQuery(document).ready(function($) {$('a[rel*=facebox]').facebox() })</script>
and Change it into;
<script type="text/javascript">jQuery.noConflict();jQuery(document).ready(function($) {$('a[rel*=facebox]').facebox() })</script>
Nothing Change, Same error

EDIT: This is the documentation official: https://github.com/defunkt/facebox

Nothing, this is the documentation official: https://github.com/defunkt/facebox
The shorthand jQuery object is perfectly fine. That's not the issue. There just needs to be a space after the opening curly brackets.

<script type="text/javascript">$.noConflict();jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox() })</script>
Nothing
I tried it myself. It has to work. Make sure you copied and pasted the code correctly.
Yes, If you want I can try and give an account admin