0

I have built a page using JQM where a lot of its content is within a collapsible-set. I want to add the functionality of where a specific collapsible is expanded depending on the URL, but cannot figure out how to do it. I have tried numerous attempts at it without luck, and hope that someone here knows how to do it.

A simplified version of the code I am using can be seen here: https://jsfiddle.net/usa8bjh1/4/

The live version of the page can be found here: http://www.drapogdesign.com#howWhat

The code that I am trying to expand the collapsibles with is:

$(document).ready(function() {
    var project = GetURLParameter("heading");

if(project){
    ("#heading").collapsible( "option", "collapsed", false );
}
});

If I have understood this bit of code correctly, it looks for the proper parameter, in this case "heading", after which the action of expanding should be applied to the collapsible with the ID of #heading.

I have tried adding "?heading" to the URL without luck, as the page shows as normal.

I would preferrably want this to be a general request, so that I don't have to add a function for each collapsible, but rather a unique ID which could then be used for the URL as well.

shvoldum
  • 11
  • 2
  • BTW; This link (http://www.dynamicdrive.com/dynamicindex17/ddaccordion_suppliment.htm) describes what I want to do, but I haven't found anything similar for JQM.. – shvoldum Apr 19 '16 at 14:19
  • you need to use `pagecontainerbeforechange`. – Omar Apr 19 '16 at 15:35
  • You mean like this: $(document).on("pagecontainerbeforechange", function(event){ var project = GetURLParameter("heading"); if(project){ ("#heading").collapsible( "option", "collapsed", false ); } }); I couldn't get this to work - any chance you could elaborate? – shvoldum Apr 21 '16 at 06:49
  • read this answer http://stackoverflow.com/a/26393037/1771795 – Omar Apr 21 '16 at 11:42

0 Answers0