Active Accordeon菜单不适用于带有查询字符串的子链接

编程入门 行业动态 更新时间:2024-10-19 03:35:43
本文介绍了Active Accordeon菜单不适用于带有查询字符串的子链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

@Ejay如果我在此链接的某些子链接中单击,请帮助我设置打开主链接。

此处:设置为 active单击后的手风琴菜单

我进行了一些修改,例如:

< script type = text / javascript> $ {document).ready(function(){ var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/' )+ 1); var url = sPage.split('?')[0]; $('dd')。filter(function(){ return $('a [href ='+ url +']',$(this))。length == 0 })。hide(); $('dt a.submenu')。click(function(){ $( dd:visible)。slideUp( slow); $(this).parent()。next ('dd')。slideDown( slow); 返回false; }); }); < / script>

该脚本仅在我的链接为

< a href = test.asp> TESTE< / a>

如果我的链接是这样的:< a href = test。 asp?category = BLABLABLA> BLABLABLA< / a> 这不起作用。

出什么问题了

可以在此处部分查看菜单: alsite .br / saks_div /

解决方案

如果

var sPath = window.location.pathname;

适用于类似 abc.asp 的URL以下应与具有查询字符串的URL一起使用,例如 produtos_categoria.asp?categoria = something

var sPath = window.location.pathname + window.location.search;

@Ejay Help me to set "opened" the main link if i click iin some sublinks of this...

here: Set "active" accordion menu after click

i make some modifications like:

<script type="text/javascript"> $(document).ready(function(){ var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); var url = sPage.split('?')[0]; $('dd').filter(function () { return $('a[href="' + url + '"]', $(this)).length == 0 }).hide(); $('dt a.submenu').click(function () { $("dd:visible").slideUp("slow"); $(this).parent().next('dd').slideDown("slow"); return false; }); }); </script>

This script only works if my link is

<a href="test.asp">TESTE</a>

if my link is that way: <a href="test.asp?category=BLABLABLA">BLABLABLA</a> this don't work..

what is wrong

Can see the menu working partly here: alsite.br/saks_div/

解决方案

if

var sPath = window.location.pathname;

works for URL's like abc.asp then following should work with URL's having a query string, e.g., produtos_categoria.asp?categoria=something

var sPath = window.location.pathname+window.location.search;

更多推荐

Active Accordeon菜单不适用于带有查询字符串的子链接

本文发布于:2023-11-30 17:38:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650923.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   不适用于   菜单   链接   Active

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!