Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-09-2011, 10:35 AM   PM User | #1
vabrown89
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
vabrown89 is an unknown quantity at this point
Spry Accordion issue with links and open panels

Hi, I am using a spry accordion as a navigation bar. The tabs are the main links and I have sub-links inside the content panels.

The problem is that although I am using script to specify which panel I want to be open on each page, when I go to that page it only highlights the tab, showing that it is selected but not open. This means you then have to click the tab again in order to open the sub menu. I want the content panel to be open on those pages that are linked to by a sub menu.

This is the code I am using, according to the multiple sites I have found it it SHOULD open the panel, but it doesn't:

Code:
<script type="text/javascript"> var Accordion1 = new Spry.Widget.Accordion("Accordion1", { enableAnimation: true, useFixedPanelHeights: false, defaultPanel: 4 });  </script>
It works for the first tab but I suspect this is because the default in the js is set to 0 like so:

Code:
Spry.Widget.Accordion = function(element, opts)
{
	this.element = this.getElement(element);
	this.defaultPanel = 0;
I have just started to learn all this so please don't mock me if this is an ignorant question, what am I doing wrong?
vabrown89 is offline   Reply With Quote
Old 11-09-2011, 01:04 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
, just fyi this is not jQuery it's an adobre product typically included with dreamweaver.

I looked at the documentation and it doesnt appear to have such an option by default. ( http://labs.adobe.com/technologies/s...dion_overview/)

you could maybe assign functions o each panel programatically.

Code:
<input type="button" onclick="acc10.openFirstPanel()" >open first panel</input>
<input type="button" onclick="acc10.openNextPanel()" >open next panel</input>
<input type="button" onclick="acc10.openPreviousPanel()" >open previous panel</input>
<input type="button" onclick="acc10.openLastPanel()" >open last panel</input>
<script type="text/javascript">
	var acc10 = new Spry.Widget.Accordion("Accordion1");
</script>
this is the exmple for assigning via onclick but you could always assign those to various hover events instead of onclick.
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 11-09-2011, 11:27 PM   PM User | #3
vabrown89
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
vabrown89 is an unknown quantity at this point
Thank you that is very helpful! However because I'm such a noob I'm not sure where I should put the code or how to customise it to work for each page. Would you mind explaining in a bit more detail for me?

Thank you!
vabrown89 is offline   Reply With Quote
Old 11-10-2011, 01:23 AM   PM User | #4
vabrown89
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
vabrown89 is an unknown quantity at this point
Never mind, I have figured it out! The code I was using was correct, I just had conflicting js just above it. Thanks for your help.
vabrown89 is offline   Reply With Quote
Reply

Bookmarks

Tags
accordion, jquery, links, spry

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:07 AM.


Advertisement
Log in to turn off these ads.