473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

need help with JS mouseover/popup: appears to the left instead of the right

I'm working on redesigning our site and I'm having a problem with a JS mouseover/popup. Hopefully someone here can help me. Right now, when you mouse over an ad, you get a larger version of the ad in a popup window that appears to the left. What I need to do is make it popup to the right instead.

You can see the current popup in action here: http://www.stltoday.com/autos

Go to the Featured Autos section.

This is the JS that it's using:
Expand|Select|Wrap|Line Numbers
  1. function showAdLeft(objname) {
  2.  
  3.   if(document.getElementById) {
  4.     var adobj=document.getElementById('ad'+objname); // the floating ad
  5.     var obj=document.getElementById(objname); // the graphic link
  6.     var objleft=obj.offsetLeft;
  7.     var objtop=obj.offsetTop;
  8.     var objwidth=obj.offsetWidth;
  9.     var objheight=obj.offsetHeight;
  10.     var objxcenter=(objwidth/2)+objleft;
  11.     var objycenter=(objheight/2) +objtop;
  12.     var objybottom=obj.offsetHeight;
  13.     var adobjwidth=adobj.offsetWidth;
  14.     var adobjheight=adobj.offsetHeight;
  15.     var adobjxcenter=adobjwidth/2;
  16.     var adobjycenter=adobjheight/2;
  17.     adobj.style.left=objleft-adobjwidth;
  18.     adobj.style.top=objycenter-adobjycenter;
  19.     adobj.style.visibility="visible"
  20.   }
  21. }
  22.  
  23. function showAdRight(objname) {
  24.  
  25.   if(document.getElementById) {
  26.     var adobj=document.getElementById('ad'+objname); // the floating ad
  27.     var obj=document.getElementById(objname); // the graphic link
  28.     var objleft=obj.offsetLeft-150;     //Make adjustment for being in right column
  29.     var objtop=obj.offsetTop;
  30.     var objwidth=obj.offsetWidth;
  31.     var objheight=obj.offsetHeight;
  32.     var objxcenter=(objwidth/2)+objleft;
  33.     var objycenter=(objheight/2) +objtop;
  34.     var objybottom=obj.offsetHeight;
  35.     var adobjwidth=adobj.offsetWidth;
  36.     var adobjheight=adobj.offsetHeight;
  37.     var adobjxcenter=adobjwidth/2;
  38.     var adobjycenter=adobjheight/2;
  39.     adobj.style.left=objleft-adobjwidth;
  40.     adobj.style.top=objycenter-adobjycenter;
  41.     adobj.style.visibility="visible"
  42.   }
  43. }
  44.  
  45. function hideAd(objname) {
  46.   if(document.getElementById) {
  47.     adobj=document.getElementById('ad' +objname);
  48.     adobj.style.visibility="hidden"
  49.   }
  50. }
  51.  
  52. // -->
  53. </script>
  54.  
I'm assuming this should be an easy fix, but I have no idea where to start. Again, if anyone can help, I would greatly appreciate it. Thanks!

Steve
May 3 '08 #1
2 1367
hsriat
1,654 Expert 1GB
Just add around 300px to the style.left property each time you display it.

PS: You website is not cross browser. The mouseover thing doesn't position properly in Firefox and Safari.
May 4 '08 #2
acoder
16,027 Expert Mod 8TB
When setting left and top properties, don't forget the units, e.g. "px". This will make it work in non-IE browsers too.
May 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: R.Wieser | last post by:
Hello All, I'm trying to get a "Virtual Listbox" to work. I've currently got a form, and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and LBS_NODATA flags on it. I've...
7
by: Warren Post | last post by:
I´m trying to implement a:hover popup images like Eric Meyer did at <http://meyerweb.com/eric/css/edge/popups/demo2.html>. My take is at <http://www.cafecopan.com/dev/20050523/>. Mozilla 1.6 and...
2
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
1
by: giloosh | last post by:
Hello All, How can you continue the mouseover event while the mouse is still over an object? For example: I put my mouse over a hyperlink and that triggers an object to move 10px to the right....
1
by: no spam | last post by:
Hi, I want to encapsulate code to change BUTTON elements on a webpage in one place in an HTC file. Here is the code in my HTC FIle: <PUBLIC:COMPONENT> <PUBLIC:ATTACH EVENT="onmouseup" ...
3
by: udayanu | last post by:
hi, can anybody help me to how to create bubble popup window with table row on mouseover with all the data of that row in popup and position of popup window will left side near that row. in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.