jQuery accordion - close all sections on page load

A place for discussion about skinning and design. Before posting questions here you should review the documentation about creating skins.

This thread is closed to new posts. You must sign in to post in the forums.
8/18/2014 1:43:17 PM
Gravatar
Total Posts 11

jQuery accordion - close all sections on page load

Hi,

I have implemented the mojo-accordion-nh content template and I found this great article here about how to get it to close on page load.  The only problem is, it's not working.

I replaced the script loader tag with what is in the article, on the layout.master page for my custom skin (which is a modified Artisteer skin), and it makes no difference.  The initial section remains open on page load.  Do I need to touch the web.config to get it to jolt it into action?

Thanks much!
Veronica

8/18/2014 1:46:17 PM
Gravatar
Total Posts 11

Re: jQuery accordion - close all sections on page load

I forgot to add, I wasn't sure if this should go here or the development forum. 

I'm running mojoPortal Version 2.4.0.3 MSSQL

8/18/2014 4:48:13 PM
Gravatar
Total Posts 1188
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: jQuery accordion - close all sections on page load

Hi there. I just tested this on the current codeline and it's working as documented for me, so you may have a missing piece of the puzzle. A simple test is to drop a new HTML instance on a page. Go into the editor's Source view, and paste in the following HTML, consisting of the default accordion and its associated custom JavaScript. When you save and view the page, the accordion should appear fully collapsed. You mentioned changing the Layout Master to include the JavaScript portion? One suggestion I have is to select View, Source, and make sure that the JavaScript is appearing where you are expecting it to. The most important thing is that the class names match between the accordion div and the JavaScript.

<p>Paragraph before the accordion</p>

<div class="collapsed-accordion">
<h3><a href="#">Section 1</a></h3>

<div>
<p>Section 1 content.</p>
</div>

<h3><a href="#">Section 2</a></h3>

<div>
<p>Section 2 content</p>
</div>

<h3><a href="#">Section 3</a></h3>

<div>
<p>Section 3 content</p>
</div>

<h3><a href="#">Section 4</a></h3>

<div>
<p>Section 4 content</p>
</div>
</div>

<p>Paragraph after the accordion</p>
<script type="text/javascript">// <![CDATA[
$('div.collapsed-accordion').accordion({active:false, collapsible:true, autoHeight:false, fx:{opacity:'toggle',duration:'fast'}});
// ]]></script>

I hope this helps,
Jamie

8/18/2014 8:27:03 PM
Gravatar
Total Posts 11

Re: jQuery accordion - close all sections on page load

Hi Jamie,

Thanks for the reply!

This is so weird.  I did try the page level code and it did some weird stuff on the page (like the footer cut off the accordion).  I copied and pasted the code this morning too so I know it wasn't a type-o.

I just created another test page, added the code you posted, inserted the content from my other test page, and it's behaving exactly the way it should. LOL  I swear, gremlins or something must have been playing around this morning.

Sorry to have bothered with an unnecessary question!

Sincerely,
Veronica

8/19/2014 7:30:02 AM
Gravatar
Total Posts 11

Re: jQuery accordion - close all sections on page load

I spoke too soon.  It's doing that weird thing where the accordion vanished behind the footer and is not scrollable.  And it happened after I removed the last section from the template.  It was working up until then.  I should mention that I'm trying to use the floating panels within the accordion so it may be that the two are fighting.

Also, I wanted to ask, the article sounded like you could do the scriptloader change for ALL accordions on the site or you could add the modified div to individual pages.

I did the scriptloader in the layout.master because I want all accordions to load this way (on this particular site).  I replaced the existing tag with: <portal:ScriptLoader ID="ScriptLoader1" runat="server" IncludeSizzle="true" JQueryAccordionConfig="{active:false, collapsible:true, autoHeight:false, fx:{opacity:'toggle',duration:'fast'}}" />

Am I missing a puzzle piece?

8/19/2014 9:56:06 AM
Gravatar
Total Posts 11

Re: jQuery accordion - close all sections on page load

I just tried this with a simple div toggle (jQuery) and it does the same thing.  The toggled div vanishes behind the footer and the page doesn't auto expand.

The code I've used is:

<p><a href="#" id="toggle1">MY TOGGLE BUTTON</a></p>

<div class="toggle1" style="display:none;">
<h4><strong>HEADING</strong></h4>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce convallis porttitor risus sit amet sodales. Maecenas imperdiet pellentesque mi, in bibendum ante volutpat condimentum. Vivamus laoreet vulputate odio sed tincidunt. Phasellus facilisis purus sit amet tortor gravida, at varius nibh mattis. Aenean congue, turpis pellentesque blandit tincidunt, tortor tellus condimentum ligula, sit amet dapibus odio justo et ipsum. Aliquam vel rutrum nisi, ac malesuada justo. Fusce mi magna, mattis quis posuere vulputate, facilisis in enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque mollis neque nec ligula vestibulum, a imperdiet nulla pellentesque. Sed eu tristique velit. Aenean fringilla mollis odio, id pulvinar nisl aliquam ac. Sed arcu nisl, interdum quis tortor eget, ullamcorper tincidunt ligula. Ut dapibus ante et ullamcorper mollis. Pellentesque sollicitudin nisl metus, et semper tellus posuere quis. Nulla pulvinar ligula quam, sed faucibus libero cursus eu. Nam eu tincidunt dolor, ut laoreet orci. </p>

<h4><strong>HEADING</strong></h4>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce convallis porttitor risus sit amet sodales. Maecenas imperdiet pellentesque mi, in bibendum ante volutpat condimentum. Vivamus laoreet vulputate odio sed tincidunt. Phasellus facilisis purus sit amet tortor gravida, at varius nibh mattis. Aenean congue, turpis pellentesque blandit tincidunt, tortor tellus condimentum ligula, sit amet dapibus odio justo et ipsum. Aliquam vel rutrum nisi, ac malesuada justo. Fusce mi magna, mattis quis posuere vulputate, facilisis in enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque mollis neque nec ligula vestibulum, a imperdiet nulla pellentesque. Sed eu tristique velit. Aenean fringilla mollis odio, id pulvinar nisl aliquam ac. Sed arcu nisl, interdum quis tortor eget, ullamcorper tincidunt ligula. Ut dapibus ante et ullamcorper mollis. Pellentesque sollicitudin nisl metus, et semper tellus posuere quis. Nulla pulvinar ligula quam, sed faucibus libero cursus eu. Nam eu tincidunt dolor, ut laoreet orci. </p>
</div>

<script type="text/javascript">// <![CDATA[
$('#toggle1').click(function() {
    $('.toggle1').toggle();
    return false;
});

// ]]></script>

The toggle itself works but it messes with way the footer behaves.  The skin is an Artisteer skin which I have tweaked.  I do not think I've done anything with the footer aside from give it a min height.

Any ideas?

Sorry to keep posting, but I keep trying things to see if they will work. :)

Sincerely,
Veronica

8/19/2014 10:46:14 AM
Gravatar
Total Posts 1188
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: jQuery accordion - close all sections on page load

Your example worked for me. I created a new page with a single HTML instance on it, and the toggle works perfectly; when it expands it pushes the footer down as expected. We use Artisteer skins as well, but there are so many different kinds of Artisteer page configurations that it would be impossible to remotely pinpoint the cause of your particular issue.

I'd recommend you use the browser's "F12" design tools with some trial and error CSS updates, so you can figure out exactly what directive is causing the footer issues you're seeing. Once you have the culprit identified it should be really easy to fix it up in the skin CSS.

Jamie

8/19/2014 11:05:02 AM
Gravatar
Total Posts 11

Re: jQuery accordion - close all sections on page load

I did verify that it was my skin, by choosing one of the default mojoPortal ones and having the code work flawlessly.

Then I pulled up the page with Firebug inspecting it (after reverting to my custom skin) and clicked off the min-height property, and sure enough, there was my culprit.  Works fine without that css property.

I've never had a min-height cause such an issue before but I guess we learn something new every day!

Thanks again!  Much appreciated!  Sometime we need to be steered in the simplest direction because we tend to over complicate things I think. LOL

I love the ease of Artisteer but hate all the extra junk and markup it puts in.

Sincerely,
Veronica Harris

You must sign in to post in the forums. This thread is closed to new posts.