MyBB Community Forums
javascript help please - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Themes (https://community.mybb.com/forum-103.html)
+---- Forum: Theme Support (https://community.mybb.com/forum-10.html)
+---- Thread: javascript help please (/thread-30533.html)



javascript help please - Jitendra M - 2008-04-11

if (navigator.userAgent.indexOf("Safari") > 0)
{
  isSafari = true;
  isMoz = false;
  isIE = false;
}
else if (navigator.product == "Gecko")
{
  isSafari = false;
  isMoz = true;
  isIE = false;
}
else
{
  isSafari = false;
  isMoz = false;
  isIE = true;
}

function attachListener(element, type, listener)
{
	if(element.addEventListener)
	{
		element.addEventListener(type, listener, false);
	}
	else
	{
		element.attachEvent("on"+type, listener, false);
	}
}

function removeListener(element, type, listener)
{
	if(element.removeEventListener)
	{
		element.removeEventListener(type, listener, false);
	}
	else
	{
		element.detachEvent("on"+type, listener);
	}
}

function eventElement(event)
{
  if(isMoz)
  {
    return event.currentTarget;
  }
  else
  {
    return event.srcElement;
  }
}

function offsetTop(element)
{
	var top = element.offsetTop;
	while(element = element.offsetParent)
	{
		top += element.offsetTop;
	}
	return top;
}

function offsetLeft(element)
{
	var left = element.offsetLeft;
	while((element = element.offsetParent))
	{
		left += element.offsetLeft;
	}
	return left;
}

i am currently using this jscript to open popup windows in mybb for a theme i am working on ...can someone make any changes to this so that the pulldown effect has a fade in effect....

thank you


RE: javascript help please - Yumi - 2008-04-13

Hi,

There doesn't appear to be any code which actually pops up a window or does any sort of animation effect in the above sample.
Is that all the code?

Also, could you please explain what you want exactly? If you want a popup window, MyBB provides a MyBB.popupWindow function which opens windows.
What's the pulldown fade effect for?