View Full Version : Image Viewer problem
Thee Gandalf
06-01-2005, 04:06 PM
Hi,
I am using this script (http://www.dynamicdrive.com/dynamicindex4/cmotiongallery.htm) from DynamicDrive and anm running into a problem with it.
The two main tags in the body read:
<div id="motioncontainer" style="position:relative;width:295px;height:75px;overflow:hidden;">
<div id="motiongallery" style="position:absolute;left:0;top:0;white-space: nowrap;">
Well I want to use this image viewer elsewhere on the page, but due to the fact that it's calling an ID I can only call it once. Is there a way around this?
Thanks,
Gändälf
:D
_Aerospace_Eng_
06-01-2005, 05:15 PM
Possibly. I haven't tested this but it might work. In this part of the script
function fillup(){
if (iedom){
crossmain=document.getElementById? document.getElementById("motioncontainer") : document.all.motioncontainer
menuwidth=parseInt(crossmain.style.width)
mainobjoffset=getposOffset(crossmain, "left")
cross_scroll=document.getElementById? document.getElementById("motiongallery") : document.all.motiongallery
document.getElementById("temp").innerHTML=cross_scroll.innerHTML //NEW stuff
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
if (!window.opera) document.getElementById("temp").style.display="none"
crossmain.onmousemove=function(e){
motionengine(e)
}
You have motioncontainer and motion gallery if you replicate this function changing those ids to another id you want to use it should work. You are then going to have to use the body onload to get the scripts to work.
<body onload="fillup();fillup2();">
You would need to take out window.onload=fillup from the original script. Let us know how it goes.
Thee Gandalf
06-01-2005, 06:53 PM
Okay. But isn't body onload something we try to refrain from using? If they have disabled JavaScript then I guess they are screwed anyway. Do people really disable JS in their browsers??
Thanks,
Gänd
:D
_Aerospace_Eng_
06-01-2005, 11:12 PM
You have about 5 percent that disable javascript, I have heard that from somewhere but can't recall from where. Like you said the body onload is usually used in conjunction with javascript so if they have javascript off the onload won't work.
Thee Gandalf
06-02-2005, 02:49 PM
What is the reasoning behind disabling JS again?
_Aerospace_Eng_
06-02-2005, 02:52 PM
Some users want their context menus for those sites that have the crappy no right click scripts. Some users don't like activex controls trying to run on them with the possibility of the active x being malicious. Some users don't like to be redirected to a page they came from. Some users don't like tracking cookies that are most of the time with javascript.
Thee Gandalf
06-07-2005, 02:53 PM
Hi,
I have returned from a short weekend vacation and am replying to this thread again now that I have time to address the issue.
Take a look at this link (http://www.nogreaterlove.org/gandalf/gallery.html) for an page update. As you will now notice, there are three rows of scrollable thumbnails that are to open up in the right section.
The top row works fine. How might we get the other two rows to work as well?
Any/all suggestions are welcome.
Thanks,
Gänd
:D
_Aerospace_Eng_
06-07-2005, 03:00 PM
Did you even try my suggestion?
Thee Gandalf
06-07-2005, 03:02 PM
My apoligies.
I believe I momentairly lost my mind. No further excuse.
Testing it now.
G
:D
Thee Gandalf
06-07-2005, 03:33 PM
Okay, I tested your code and it didn't work. However, I am pasting the code here to show you my exact changes to make sure that I followed your instructions to the "T".
Oh by the way, on that previous link I gave you, all of the thumbnails of all three rows did work, they simply wouldn't scroll.
Okay, here is the altered code:
function fillup(){
if (iedom){
crossmain=document.getElementById? document.getElementById("motioncontainer") : document.all.motioncontainer
menuwidth=parseInt(crossmain.style.width)
mainobjoffset=getposOffset(crossmain, "left")
cross_scroll=document.getElementById? document.getElementById("motiongallery") : document.all.motiongallery
document.getElementById("temp").innerHTML=cross_scroll.innerHTML //NEW stuff
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
if (!window.opera) document.getElementById("temp").style.display="none"
crossmain.onmousemove=function(e){
motionengine(e)
}
crossmain.onmouseout=function(e){
stopmotion(e)
showhidediv("hidden")
}
}
loadedyes=1
if (endofgallerymsg!=""){
creatediv()
positiondiv()
}
}
I replicated the function code above twice and changed the 2nd and 3rd function names to this:
function fillup2kd(){
document.getElementById("motioncontainer2kd")
document.getElementById("motiongallery2kd")
function fillup3indy(){
document.getElementById("motioncontainer3indy")
document.getElementById("motiongallery3indy")
I removed the following from the last line of code in the JS file:
window.onload=fillup
The <body> now reads:
<body onload="fillup();fillup2kd();fillup3indy();">
Is there something I missed? Here is the link (http://www.nogreaterlove.org/gandalf/scripts/motiongallery.js) to the updated JS file.
Thanks,
Gänd
:D
Thee Gandalf
06-07-2005, 03:43 PM
P.s. How do you get the code (even HTML code) to be in color??
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.