Web Hosting Talk







View Full Version : Weird javascript bug I can't figure out.


Mechphisto
11-24-2008, 05:41 PM
Weird javascript bug I can't figure out.

I'm building a new site and using a pre-packaged JavaScript menu script.
I've formatted it and changed its CSS and whatnot, and it works fine in general, except one really odd issue:http://www.girlscoutsmoheartland.org...ment/index.htm
Notice in the top-left menu. When you mouse-over "for VISITORS" "the PROGRAMS" or "the SHOP" the menu item box shifts to the right a few pixels, but when you mouse-over "for GIRLS" and "for VOLUNTEERS" it stays static.
In the source code, there's no difference between the items that move fine and the ones that don't.
I can't find any reason this is happening.
Any ideas what I should be looking for?
Thanks for any pointers!
-Liam

bear
11-24-2008, 06:48 PM
Each menu item that shifts has an extra style tag in line:
Quote:


<a href="#" id="ulaitem0z1" class="" rvframes="4" rvendxy="10,0" rvdxy="2.5,0" rvinit="1" rvfr="-1" style="left: 0px; top: 0px;"><img align="left" class="car_img" alt="carrot right" src="images/car_right.gif"/>for VISITORS</a>


Try removing that?





__________________Did you know WHT has a help desk?
Have a forum? Let's face it, you need help.

Mechphisto
11-25-2008, 10:27 AM
Wha?? Where are you seeing that??
Here's what I see in the the browser's source code:
Quote:


<li class="imatm" style="width:100%;"><a href="#"><img src="images/car_right.gif" alt="carrot right" align="left" class="car_img">for VISITORS</a>

bear
11-25-2008, 10:53 AM
Weird. It only shows when viewing with Firefox "firebug" extension. Using that, when I roll over the link, it states to add 7px to the left padding (why it shifts) and that style declaration.
Find in your scripts and CSS where these are defined and you will probably locate the cause:
id="ulaitem0z1"
rvframes="4"





__________________Did you know WHT has a help desk?
Have a forum? Let's face it, you need help.

Mechphisto
11-25-2008, 11:11 AM
OK, I did a search for ulaitem and in the .js file I found these sections:
function imenus_shift_ani(id,rev){
// alert(id)
if(id=="ulaitem0_2") return;
if(id=="ulaitem0z2") return;
if(id=="ulaitem0_0") return;
if(id=="ulaitem0z0") return;
and:
(this.atag=a.getElementsByTagName("A")[0]).id="ulaitem"+prefix+counter;if(c=this.atag.getAttribute("himg")){ulm_mglobal["timg"+a.id]=new Image();
unfortunately I have no idea what these mean. But if this is the source of the cause, I know what I should be playing around with then.
Thanks for the tip!
-Liam

Mechphisto
11-25-2008, 11:24 AM
I installed firebug and I see what you mean. Kickbutt add-on!
Showed me immediately how each box is numbered. The two not shifting coinciding with the 0_0 and 0_2 in the "alert" funtion I pasted above.
I don't know what purpose that's there for, but I just commented out those lines and voila! All of them shift now.
Thanks for the assistance!!
-Liam

bear
11-25-2008, 11:43 AM
You're welcome, but you did the heavy lifting . Firebug is probably my favorite addon for FF.





__________________Did you know WHT has a help desk?
Have a forum? Let's face it, you need help.