1.

Solve : Need Javascript/Scritaculous help!?

Answer»

I'm trying to make some portions of my SITE able to be turned on and off using the scriptaculous javascripts.

I have a section where I want to embed two videos, but I want the section to be collapsable.

Here's what I have in the section:
CODE: [Select]<div align="center" id="vidbox" style="width:855px;"&GT;
      <img src="../../images/general/bar.gif" hspace="0" vspace="0" border="0" onc lick="new EFFECT.Toggle($('vid'),'blind')"/>
      <div id="vid" style="border:#666666; border:medium;">
            <s cript type="text/j avascript">
            AC_AX_RunC ontent(youtube video); //end AC code
            AC_AX_RunC ontent(youtube video); //end AC code
            </s cript>
      </div>
      <img src="../../images/general/barbottom.gif" hspace="0" vspace="0" border="0" />
</div>
At this point, it doesn't seem like the scripts are working at ALL.

I have these four lines in the HEAD portion of the document:

Code: [Select]<s cript src="../../scripts/AC_ActiveX.j s" type="text/j avascript"></s cript>
<s cript src="../../scripts/AC_RunActiveContent.j s" type="text/j avascript"></s cript>
<s cript src="../../scripts/int/prototype.j s" type="text/j avascript"></s cript>
<s cript src="../../scripts/int/scriptaculous.j s" type="text/j avascript"></s cript>
I don't understand why this is not working.  If someone could give me some pointers to get this working, I'd be very grateful.

-rock

p.s. I wasn't sure which scripts were causing the post to not work, so there are a lot of spaces spread around in this that aren't actually there.Can you provide a link to the page in question, please?http://tomrandolph.dyn-o-saur.com/archives/15.11.06/moviesmain.htm

I've also moved the "onclick" code into the first div, that may or may not change the use-ability of the page.  If it were working, I'd know.


Oh, in a related note, how do I decrease the gap between the videos and the top bar to nothing?  I have a feeling it has to do with absolute image positioning, and I'm not very clear on how to do that.

-rockBUMP

...

Anything?Well I can see one problem here:

...onclick="new Effect.Toggle...

None of the javascript has defined the function or object "Effect".  So there's no way that's going to work.

Personally, if I wanted to show or hide elements, I would use an "onClick" event to amend the CSS - e.g. document.getElementById('whatever').style.display = 'none';

Set .display to '' to make the element show again.  Have a read >here<.Hmmm, those scripts came pre-made, I can't imagine they would screw it up that badly.  However, I'd rather write it myself, so thanks for the link.

Edit:

I got the shrinking/growing to work perfectly, but the +/- image never changes, same link.  Any ideas?In swapImage(), instead of:

button.src = "../../images/general/button/minus.gif";

you need:

document.getElementById(button).src = ...Hmm, still isn't working.Sorry - wasn't concentrating well enough.  "button1" needs to be in inverted commas.OH!  It's SOOOOO close.  I'm working on this problem myself as well, but I would appreciate any more help you can give.

When I click the top bar, it now just disappears.  Dunno why, I'm thinking it has to do with the state switching part.

-rock

edit:

Got the top bar to not disappear...I probably just changed the code BACK.  This code SHOULD work.  I don't understand why it isn't.Just take a closer look at this section:

Code: [Select]function swapImage(image, state) {
if (state == "minus") {
document.getElementById('button1').src = "../../images/general/button/barplus.gif";
}
if (state == "plus") {
document.getElementById('button1').src = "../../images/general/button/barplus.gif";
}
}
The same both times...?Mmm, yeah.  I changed that...probably soon after you saw it.  Didn't help.

I did figure out the problem though: I'm a freaking idiot.

^--Yeah.

Had the image sources pointing to a non-existent folder.  After a bit of personal tweaking, it works just fine.

I feel stupid, but thank you very much for your help.

For anyone who's interested, the link to the page is in a few of the above posts, and it works like a charm right now.

-rockOh, I see, that's what you wanted to do. I would have been able to help, it's just that I didn't exactly know what you were talking about.



Discussion

No Comment Found