| | |
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
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser bug calendar captchaformproblem cart close codes column cookies createrange() css cursor date debugger decimal dependent design dom download dropdown element embed enter error events firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe images index java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onmouseover paypal php player position post problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select software sql text textarea toggle unicode variables w3c webservice website window windowofwords windowsxp





