ElkArte Community

Elk Development => Theme development => Theme development archive => Topic started by: scripple on March 21, 2014, 02:22:44 am

Title: Ok, how does the page index work?
Post by: scripple on March 21, 2014, 02:22:44 am
I'm trying to put your page index on a custom page.  It works except that once the ellipses hover function brings up the hover activated page selection it never goes away.

What trick am I missing?

Code: [Select]
	echo '
<ul class="pagelinks floatleft sf-js-enabled" role="menubar">',
  $context['page_index'],
'</ul>';

Some script I have to include?  I've got the standard html and body templates loading so the default set of scripts and variables are there.

Help please.
Title: Re: Ok, how does the page index work?
Post by: Antechinus on March 21, 2014, 03:03:38 am
sf-js-enabled is a class that is applied via jQuery Superfish plug-in. It shouldn't actually be in your markup.

Dunno if that's causing a problem, but I'd lose it from the markup anyway.
Title: Re: Ok, how does the page index work?
Post by: scripple on March 21, 2014, 10:36:08 am
Yes that fixed it.  Thank you.

I do wonder why the script doesn't work since I've loaded all the elk scripts.  Doesn't really matter though I guess.
Title: Re: Ok, how does the page index work?
Post by: emanuele on March 22, 2014, 10:58:53 am
It may be that jQuery (or superfish) remembers the classes that were applied before doing its job and probably it doesn't remove that one or it gets confused by finding a class that should not be there... dunno, difficult to say...
Title: Re: Ok, how does the page index work?
Post by: scripple on March 22, 2014, 02:40:56 pm
Quote from: emanuele – It may be that jQuery (or superfish) remembers the classes that were applied before doing its job and probably it doesn't remove that one or it gets confused by finding a class that should not be there... dunno, difficult to say...
I copied the page link markup from another page.  That's why it's odd it doesn't work.  It's not even a new class.  But no big deal.
Title: Re: Ok, how does the page index work?
Post by: emanuele on March 22, 2014, 04:08:04 pm
Yep, but the class is (normally) added via javascript by superfish itself and is not actually present in the template, see:
https://github.com/elkarte/Elkarte/blob/6706f00da7f9eb76305a6bc291c4ddd7e59457e7/themes/default/index.template.php#L741
The "exact line" is 748.
Title: Re: Ok, how does the page index work?
Post by: scripple on March 22, 2014, 05:52:41 pm
Oh, it's added by the javascript not a message for the javascript to do something with it.  Now I understand.  Thanks.
Title: Re: Ok, how does the page index work?
Post by: Antechinus on March 22, 2014, 05:59:16 pm
Quote from: scripple – Yes that fixed it.  Thank you.

I do wonder why the script doesn't work since I've loaded all the elk scripts.  Doesn't really matter though I guess.
What isn't working?
Title: Re: Ok, how does the page index work?
Post by: scripple on March 22, 2014, 06:36:35 pm
It all works.  I just wondered why adding the class broke it.  But emanuele explained that to me.  So it was user error on my part.