Topic on User talk:Jdlrobson

Collapsing code works on desktop MW, but (glaringly) NOT with MobileFrontend

4
Slgrandson (talkcontribs)

Good day, Mr. Jdlrobson. Yesterday, after hours of experimentation, I implemented an alternative to MW's standard Navboxes in the form of this Collapse Widget on my Referata wiki, The Dixwell Dossier. (Inspired by this StackExchange thread from July 2013, and this answer by "DavidLin".)

I'm already aware that MobileFrontend can't support Navbox because, as I've heard, it's too clunky and unwieldy for mobile. As such, I came up with an alternative that's supposed to be backwards-compatible by design. On the regular MW, the prototype code's "Expand/Collapse" function works with no problems (as is currently demonstrated in the Sandbox on that site), but when seen on the mobile view... Nothing happens. "Expand" is unchanged and unclickable, and the items that are supposed to be hidden below are exposed to view.

I wonder if you can come up with a mobile-compliant/MW-compliant JavaScript fix, or have I run into a bug on MobileFrontend's part?

Jdlrobson (talkcontribs)

Hi @Slgrandson it looks like the script tag is being rendered above the navbox. The code is running but it runs before the navbox is rendered.

You'll need to wrap this to make sure it only executes when ready. $( function() { // code } )

I'm not sure why it is working in desktop mode - is it possible there is a gadget or another extension making it work?

Slgrandson (talkcontribs)

Thanks to your patch, looks like it's now working on both sides; see for yourself. Thanks a dozen!

Don't think gadgets or extensions were involved before I gave it another go.

Jdlrobson (talkcontribs)

Awesome!:)

Reply to "Collapsing code works on desktop MW, but (glaringly) NOT with MobileFrontend"