| | |
Ajax help => Scriptculous
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hello,
I'm a noob with PHP and unversed in Javascript, but I need to implement some Ajax in a page I'm building. I'm using the Scriptaculous libraries.
Here's the problem I'm having:
I have four different links in the menubar. When I click on the first link, it makes a div block appear using the effect "Appear". If I click the same link again, the div fades
The help I'm asking:
When I click a link, it should first try to fade any visible div and then make its associated div appear.
This is what I've been trying (it doesn't quite work though):
my combo.js script:
My menubar:
My dispaying page:
Thank you for any help!
I'm a noob with PHP and unversed in Javascript, but I need to implement some Ajax in a page I'm building. I'm using the Scriptaculous libraries.
Here's the problem I'm having:
I have four different links in the menubar. When I click on the first link, it makes a div block appear using the effect "Appear". If I click the same link again, the div fades
Effect.toggle . This works great. Now, I click on a new link and it does the same thing. Great. The problem arises if I have already clicked on link "A" and the div is showing and I then click on link "B". The div associated with link "B" appears over the div associated with link "A". The help I'm asking:
When I click a link, it should first try to fade any visible div and then make its associated div appear.
This is what I've been trying (it doesn't quite work though):
my combo.js script:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
Effect.OpenUp = function(element) { element = $(element); new Effect.Appear(element, arguments[1] || {}); } Effect.CloseDown = function(element) { element = $(element); new Effect.Fade(element, arguments[1] || {}); } Effect.Combo = function(element) { element = $(element); if(element.style.display != 'none') { new Effect.CloseDown(element, arguments[1] || {}); setTimeout('Effect.OpenUp(element, arguments[1] || {})', 250) } else { new Effect.OpenUp(element, arguments[1] || {}); } }
My menubar:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<div id="menubar"> <a href="#" onclick="Effect.Combo('box',{duration: .8});">about</a><br /><br /><br /> <a href="#" onclick="Effect.Combo('box',{duration: .8});">tracks</a> </div>
My dispaying page:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<div id="box" style="display:run-in;"> <p>Content Stuff.</p> </div>
Thank you for any help!
SO, I guess it does work. I just needed to change:
in my combo.js file to:
and it works. If anyone knows a cleaner way, please share. Again, I don't really know what I'm doing.
Thanks for any comments!
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
setTimeout('Effect.OpenUp(element, arguments[1] || {})', 250)
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
setTimeout('Effect.OpenUp("box",{duration: 0.8});', 1000)
Thanks for any comments!
Last edited by bigtalk; Jul 30th, 2008 at 12:37 am. Reason: Fixed typo.
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: java script help want to use it differently
- Next Thread: Help with adding java to a website
Views: 920 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxcode ajaxhelp animate api array automatically autoplay beta boarder box bug calendar captcha card cart codes column cookies createrange() css cursor date debugger decimal design developer dom download dropdown element enter error events firefox firehose flash focus form frameworks getselection google gwt html htmlform iframe image() index java javascript javascripts jawascriptruntimeerror jquery jsp listbox maps marquee masterpage menu microsoft mimic mp3 mp4 offline onmouseover parameters php player post problem programming progressbar prototype rating redirect regex safari scale scriptlets search select size sources sql starrating text textarea toggle twitter validation variables w3c web website window windowofwords windowsxp xml xspf





