PDA

View Full Version : Rollovers in Postbit


ixian
03-03-2003, 12:53 AM
What's the magic trick to get rollovers to work in the Postbit? Such as for the icons for profile, reply, quote, etc etc.

I have js rollovers working just fine in my vb header. However, when I try the exact same code even, in postbit (such as modifying postbit_profile and adding the rollover code to the link) it does not work.

I've double-checked the images - there are there in the right paths. And I don't get any javascript errors on the page - just no rollovers either. I have the js code in my vb header but I am wondering, do I need to insert it somewhere else for rollover images to work in the postbit?

Anyone with any examples? I'd really appreciate it!

Thanks,

Ixian

Tony G
03-03-2003, 02:54 AM
What code are you using? So I can check it over for you.

Chris Gwynne
03-03-2003, 03:16 AM
Everything should work if you have the code in the header, make sure there is actual images to rollover like quoteroll.gif or something like that. But, like Tony said, show us the code.. ;)

Brad
03-03-2003, 03:26 AM
Acully it would be better to stick it under the $header call in the showthread template so it isent loaded on all pages.

Chris Gwynne
03-03-2003, 04:39 AM
Acully it would be better to stick it under the $header call in the showthread template so it isent loaded on all pages.
Although if you have a separate .js file, it won't really matter, will load quicker too :p

ixian
03-03-2003, 03:28 PM
Huh. I would sworn I selected email notification for this thread, but I didn't get any.

Anyway, the code looks something like this:

In the head insert template:


<script language="JavaScript">
<!--

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>


And then, for example, in Postbit_profile (for the profile button in Postbit):


<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$post[userid]" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image110','','/assets/images/profile_01-over.gif',1)"><img src="/assets/images/profile_01.gif" alt="Profile" name="Image110" width="72" height="22" border="0"></a>


Now, as I mentioned, if I put the link above in the header template, it works fine. So, the code is working, and the images are there.

It just doesn't work if placed in, for example, postbit_profile, and I don't know why.

Could be I horked something up since I use that code for rollovers in my header already anyway. Any ideas???

Thanks!