MyBB Community Forums

Full Version: Simple Navbar issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2012-12-06, 11:08 PM)Leefish Wrote: [ -> ]do you have JQuery loading?

I'm not sure Huh could you please elaborate?
Man you said you are not good in CSS. Now it seems you don't have any programming experience. You need a step by step tutorial to accomplish such. Sad

Check back in your headerinclude if any kind of similar lines are there:
http://ajax.googleapis.com/ajax/libs/jqu...ery.min.js
http://code.jquery.com/jquery-latest.min.js

If not, then find this line:
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1600"></script>

and add just after that:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
if (typeof jQuery == 'undefined') {
    document.write(unescape("%3Cscript src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script type="text/javascript">jQuery.noConflict();</script>

Be triple sure any kind of those codes are not already in headerinclude and then only add, else you may be experiencing conflict.
Yeah, sorry I'm a complete novice, I've downloaded a template so that I can change things and learn how everything works

I have this as 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=1400"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/general.js?ver=1400"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1400"></script>
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="jscripts/pngfix.js"></script>
<![endif]-->
{$stylesheets}
<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']}";
// -->

            if(urlRegExp.test(this.href)){
                jQuery(this).addClass('current');
            }
        });
});​
</script>

And popup_menu.js looks like this:

var PopupMenu = Class.create();

PopupMenu.prototype = {

	initialize: function(id, options)
	{
		document.currentMenu = "";

		if(!$(id))
		{
			return false;
		}
		this.id = id;
		var element = $(id);
		
		var popupMenu = element.id+"_popup";
		if(!$(popupMenu))
		{
			return false;
		}
		
		this.menu = $(popupMenu);
		this.menu.style.display = "none";
		element.onclick = this.openMenu.bindAsEventListener(this);
	},
	
	openMenu: function(e)
	{
		Event.stop(e);
		if(document.currentMenu && document.currentMenu == this.id)
		{
			this.closeMenu();
			return false;
		}
		else if(document.currentMenu != "")
		{
			this.closeMenu();
		}
		
		offsetTop = offsetLeft = 0;
		var element = $(this.id);
		do
		{
			offsetTop += element.offsetTop || 0;
			offsetLeft += element.offsetLeft || 0;
			element = element.offsetParent;
			if(element)
			{
				if(Element.getStyle(element, 'position') == 'relative' || Element.getStyle(element, 'position') == 'absolute') break;
			}
		} while(element);
		offsetTopReal = offsetTop;
		offsetLeftReal = offsetLeft;
		if(element) // will be true if we broke off the last loop
		{
			// calculate the true top/left position relative to page borders (this is used for checking whether the popup menu will be displayed within the page)
			do
			{
				offsetTopReal += element.offsetTop || 0;
				offsetLeftReal += element.offsetLeft || 0;
			} while(element = element.offsetParent);
		}
		element = $(this.id);
		element.blur();
		this.menu.style.position = "absolute";
		this.menu.style.zIndex = 100;
		this.menu.style.top = (offsetTop+element.offsetHeight-1)+"px";
		// Bad browser detection - yes, only choice - yes.
		if(MyBB.browser == "opera" || MyBB.browser == "safari")
		{
			this.menu.style.top = (parseInt(this.menu.style.top)-2)+"px";
		}
		this.menu.style.left = offsetLeft+"px";
		this.menu.style.visibility = 'hidden';
		this.menu.style.display = 'block';
		if(this.menu.style.width)
		{
			menuWidth = parseInt(this.menu.style.width);
		}
		else
		{
			menuWidth = this.menu.offsetWidth;
		}
		pageSize = DomLib.getPageSize();
		if(offsetLeftReal+menuWidth >= pageSize[0])
		{
			this.menu.style.left = (offsetLeft-menuWidth+element.offsetWidth)+"px";
		}
		this.menu.style.display = 'block';	
		this.menu.style.visibility = 'visible';

		document.currentMenu = element.id;
		Event.observe(document, 'click', this.closeMenu.bindAsEventListener(this));
	},
	
	closeMenu: function()
	{
		if(!document.currentMenu)
		{
			return;
		}
		var menu = document.currentMenu;
		menu = $(menu+"_popup");
		menu.style.display = "none";
		document.currentMenu = "";
		document.onclick = function() { };
	}
};

Can you see anything in there that's preventing the class from staying as "current"?
do you have JQuery loading?
Pages: 1 2