Menu based on cssmenu

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
TPrigas
Forum Members
Forum Members
Posts: 16
Joined: Wed Mar 11, 2020 6:38 pm

Menu based on cssmenu

Post by TPrigas »

Hello!

I've customized a Menu from cssmenu. It looks fine in the page and on hover the target shows up in the status bar of the browser. But when I click a link nothing happens. Other links out of the menu are working. Here is the code:

Code: Select all

{* Ormed Menu *}
{* this template uses recursion, but not a smarty function. *}
{*
  variables:
  node: contains the current node.
  aclass: is used to build a string containing class names given to the a tag if one is used
  liclass: is used to build a string containing class names given to the li tag.
*}
{if !isset($depth)}{$depth=0}{/if}
{strip}

{if $depth == 0}
    <nav class="nav-menu d-none d-lg-block">
    <!--main-nav-start-->
	<ul class="nav-inner">
	{else}
    <ul>
{/if}

{$depth=$depth+1}
{foreach $nodes as $node}
  {* setup classes for the anchor and list item *}
  {$liclass=[]}
  {$aclass=[]}

  {* the first child gets a special class *}
  {*if $node@first && $node@total > 1}{$liclass[]='first_child'}{/if*}

  {* the last child gets a special class *}
  {*if $node@last && $node@total > 1}{$liclass[]='last_child'}{/if*}

  {if $node->current}
    {* this is the current page *}
    {*$liclass[]="menuactive active"*}
    {$liclass[]="active"}
    {*$aclass[]="menuactive"*}
  {/if}
  {if $node->has_children}
    {* this is a parent page *}
    {*$liclass[]="menuparent drop-down"*}
    {$liclass[]="drop-down"}
    {*$aclass[]="menuparent"*}
  {/if}

  {if $depth == 1 && $node@iteration == 5}
    <li class="nav-logo">
      <a href="https://ordemdosmedicos.co.ao">
        <img src="{uploads_url}/images/logo.svg" alt="Ordem dos Médicos de Angola" width="55px" alt="" class="img-fluid" />
      </a>
    </li>{*else*}{*$node->menutext*}
  {/if}

  {* build the menu item from the node *}
  {if $node->type == 'sectionheader'}
    <li class='{implode(' ',$liclass)}'><a{if count($aclass) > 0} class="{implode(' ',$aclass)}"{/if}><span class="sectionheader">{$node->menutext}</span></a>
      {if isset($node->children)}
        {include file=$smarty.template nodes=$node->children}
      {/if}
    </li>
  {else if $node->type == 'separator'}
    <li style="list-style-type: none;"><hr class="menu_separator"/></li>
  {else}
    {* regular item *}
    <li class="{implode(' ',$liclass)}">
      <a{if count($aclass) > 0} class="{implode(' ',$aclass)}"{/if} href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}><span>{$node->menutext}</span></a>
      {if isset($node->children)}
        {include file=$smarty.template nodes=$node->children}
      {/if}
    </li>
  {/if}
{/foreach}
{$depth=$depth-1}
</ul>

{if $depth == 0}

</nav><!--main-nav-end-->
{/if}
{/strip}
Thank you
Last edited by velden on Fri Apr 17, 2020 6:35 pm, edited 1 time in total.
Reason: added code tags
TPrigas
Forum Members
Forum Members
Posts: 16
Joined: Wed Mar 11, 2020 6:38 pm

Re: Menu based on cssmenu

Post by TPrigas »

Here's my system information:

----------------------------------------------

Cms Version: 2.2.14

Installed Modules:

AdminSearch: 1.0.5
CGExtensions: 1.65.2
CMSContentManager: 1.1.9
CmsJobManager: 0.1.3
DesignManager: 1.1.8
Disqus: 2.1.3
FileManager: 1.6.11
FilePicker: 1.0.4.1
Gallery: 2.4.2
MicroTiny: 2.2.4
ModuleManager: 2.1.7
Navigator: 1.0.9
News: 2.51.9
PDFGenerator: 1.0
Search: 1.51.8

Config Information:

php_memory_limit:
max_upload_size: 16000000
url_rewriting: none
page_extension:
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Africa/Luanda
permissive_smarty: false

Php Information:

phpversion: 7.3.16
md5_function: On (Verdadeiro)
json_function: On (Verdadeiro)
gd_version: 2
tempnam_function: On (Verdadeiro)
magic_quotes_runtime: Off (Falso)
E_ALL: 32759
E_STRICT: 2048
E_DEPRECATED: 8192
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 128M
max_execution_time: 180
register_globals: Off (Falso)
output_buffering: On
disable_functions: exec, passthru, shell_exec, system
open_basedir:
test_remote_url: Sucesso
file_uploads: On (Verdadeiro)
post_max_size: 16M
upload_max_filesize: 16M
session_save_path: /var/cpanel/php/sessions/ea-php73 (1733)
session_use_cookies: On (Verdadeiro)
xml_function: On (Verdadeiro)
xmlreader_class: On (Verdadeiro)
check_ini_set: On (Verdadeiro)
curl: On

Performance Information:

allow_browser_cache: On (Verdadeiro)
browser_cache_expiry: 60
php_opcache: Off (Falso)
smarty_cache: Off (Falso)
smarty_compilecheck: On (Verdadeiro)
auto_clear_cache_age: On (Verdadeiro)
Server Information:

Server Software: Apache
Server Api: fpm-fcgi
Server Os: Linux 3.10.0-1062.4.3.el7.x86_64 On x86_64
Server Db Type: MySQL (mysqli)
Server Db Version: 10.3.22
Server Db Grants: Encontrada uma declaração "GRANT ALL" que parece ser adequada

Permission Information:

tmp: /home/ormedao/public_html/tmp (0755)
tmp_cache: /home/ormedao/public_html/tmp/cache (0755)
templates_c: /home/ormedao/public_html/tmp/templates_c (0755)
modules: /home/ormedao/public_html/modules (0755)
uploads: /home/ormedao/public_html/uploads (0755)
Mascara de Criação de Ficheiros (umask): /home/ormedao/public_html/tmp/cache (0755)
config_file: 0444
----------------------------------------------
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Menu based on cssmenu

Post by DIGI3 »

Check that your html validates, and that there's nothing in the error console (F12).

Failing that, supply us with a link where we can see the page (not) working.
Not getting the answer you need? CMSMS support options
TPrigas
Forum Members
Forum Members
Posts: 16
Joined: Wed Mar 11, 2020 6:38 pm

Re: Menu based on cssmenu

Post by TPrigas »

User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Menu based on cssmenu

Post by velden »

I suspect your javascript to interfere with the links.

https://ordemdosmedicos.co.ao/uploads/ormed/js/main.js
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Menu based on cssmenu

Post by DIGI3 »

Velden is correct - putting preventDefault() on links does exactly that - prevents the default action. You'll need to make it more specific to section headers or something.
Not getting the answer you need? CMSMS support options
TPrigas
Forum Members
Forum Members
Posts: 16
Joined: Wed Mar 11, 2020 6:38 pm

Re: Menu based on cssmenu

Post by TPrigas »

Gotit Guys...

I need the preventDefault function for a few pages. Simply created another js without that funcion

Problem solved!

Thanks a lot!
Locked

Return to “Layout and Design (CSS & HTML)”