-
☆ A M B ☆
- 1,231 Posts
I’m wondering if someone could give me a run down on what i would need to do to get the accordion effect working with modx and jquery? I know it’s a plugin for jquery but how could i integrate it on to a modx page for example?
-
☆ A M B ☆
- 24,524 Posts
The same way you would in a flat HTML file. Just include the .js file in your template head and set up the layout for it in the template you’re using, for example if this is to be part of a Wayfinder-built menu.
-
☆ A M B ☆
- 1,231 Posts
Well i wanted an accordion effect on a page with content and information inside rather than a menu.
So in the head of the template i would have the <script> call as usual.... i know that bit.
It’s the actual plugin info I don’t know what to do with.
this example is taken from a jquery plugin site
jQuery(’#list2’).Accordion({
event: ’mouseover’,
active: ’.selected’,
selectedClass: ’active’,
animated: "bounceslide"
}).change(function(event, newHeader, oldHeader, newContent, oldContent) {
jQuery(’<div>’ + oldHeader.text() + ’ hidden, ’ + newHeader.text() + ’ shown</div>’).appendTo(’#log’);
});
where would this actually go in modx?
In jquery these parameters co within the <head> section off the template. How you add it there is up to you, you can either just add it straight into the template or use a tv or chunk to ’add’ it to the template on render. If this is a menu that repeats itself on every page then it should be either in the template or in a chunk that is added to the template in the <head> section.
When using jquery be sure to use the no-conflict feature to avoid any issues with the modx js features.