Accordion: function as parameter
I'm trying to pass a dynamic value for the option
active: of the accordion.
Here is my code:
- $(document).ready(function() {
- $( "#newsArticles" ).accordion({
- autoHeight: false,
- navigation: true,
- collapsible: true,
- active: function(){return parseInt($(document).getUrlParam("newsID"));}
- });
- });
I'm calling the page with mywebsite.com/the-news-section/?newsID=4
parseInt($(document).getUrlParam("newsID")) is equal to 4, or "4" without the parseInt() as seen while debugging.
In both case, it doesn't seem to work to activate a part of the accordion, instead it expands everything.
If I simply write active: 4, it does what I want to achieve.
I'm definitely doing something wrong. Any help ?
Thanks
I am using jquery-1.4.4.min.js, jquery-ui-1.8.6.custom.min.js, jquery.geturlparam.min.js