Toc/xTOC with tooltips

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Toc/xTOC with tooltips

Post by Tata » Thu Jan 03, 2013 8:44 am

Is there a way to have "hover tooltips" for menu items if there is e.g. alternative heading used?
It was explained on some of websites long ago. But it was before the jQuery was introduced with CMSimple. Now I can find the website anymore.

E.g.:

<h1>HEADING 1</h1> has an alternative heading HEADING OF THE FIRST PAGE. And this should be shown at hover in TOC.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Toc/xTOC with tooltips

Post by cmb » Thu Jan 03, 2013 1:56 pm

Hi Tata,

this can be done by modifying the function li() in cmsimple/cms.php. Around line 1058 you'll find:

Code: Select all

        if ($tf)
            $t .= '</a>'; 
Replace these 2 lines with:

Code: Select all

        if ($tf) {
            global $pd_router;

            $pd = $pd_router->find_page($ta[$i]);
            if ($pd['show_heading'] == '1') {
                $t .= '<span>' . $pd['heading'] . '</span>';
            }
            $t .= '</a>';
        } 
The rest is CSS. A primitive solution:

Code: Select all

ul.menulevel1 span {display:none}
ul.menulevel1 a:hover span {display:inline}
If you want to show the hover tooltip also for the current page, you have to use xtoc and modify it accordingly. And well, this output is generated also for the sitemap and the submenu, so their styling has to be modified to.

BTW: just yesterday I've stumpled across HIT again. Perhaps something, that might be offered as a plugin in an improved version? Any volunteers?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Toc/xTOC with tooltips

Post by Tata » Sun Sep 26, 2021 4:17 pm

Wie wäre es jetzt mit 1.7.4+?
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Post Reply