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"
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:
{* 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
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
----------------------------------------------
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.