Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何通过在html中单击另一页中的链接使类在另一页上处于活动状态_Jquery_Html_Css - Fatal编程技术网

Jquery 如何通过在html中单击另一页中的链接使类在另一页上处于活动状态

Jquery 如何通过在html中单击另一页中的链接使类在另一页上处于活动状态,jquery,html,css,Jquery,Html,Css,我有一个疑问,如果我点击链接到demo2.html页面,我是否可以在demo1.html页面中使用锚定标记。在demo2.html页面中,我使用了一个数据过滤器,它必须选择这个过滤器,我们可以这样做。 下面是我使用的示例代码 Demo1.html <a href="careers.html">Bangalore </a> | <a href="#"> Mumbai </a> <ul> <li class="filter"

我有一个疑问,如果我点击链接到demo2.html页面,我是否可以在demo1.html页面中使用锚定标记。在demo2.html页面中,我使用了一个数据过滤器,它必须选择这个过滤器,我们可以这样做。 下面是我使用的示例代码

Demo1.html

<a href="careers.html">Bangalore </a> | <a href="#"> Mumbai </a>
<ul>
    <li class="filter"><a class="selected" href="#0" data-type="all">All</a></li>
    <li class="filter" data-filter=".bangalore"><a href="#0" data-type="bangalore">Bangalore</a></li>
    <li class="filter" data-filter=".mumbai"><a href="#0" data-type="mumbai">Mumbai</a></li>
</ul>
<ul>
    <li class="mix bangalore"></li>
    <li class="mix mumbai"></li>
</ul>
|
Demo2.html

<a href="careers.html">Bangalore </a> | <a href="#"> Mumbai </a>
<ul>
    <li class="filter"><a class="selected" href="#0" data-type="all">All</a></li>
    <li class="filter" data-filter=".bangalore"><a href="#0" data-type="bangalore">Bangalore</a></li>
    <li class="filter" data-filter=".mumbai"><a href="#0" data-type="mumbai">Mumbai</a></li>
</ul>
<ul>
    <li class="mix bangalore"></li>
    <li class="mix mumbai"></li>
</ul>

我正在使用这个插件。请帮我解决这个问题。首先,创建一个函数来获取查询字符串参数,如中所示

然后更新你的链接到

<a href="careers.html?dataType=bangalore">Bangalore </a> | <a href="#"> Mumbai </a>

谢谢你的快速回复。你能详细解释一下怎么做吗?我不明白你的意思clearly@RajtheStarter,第一步是使用查询字符串(如?数据类型)更新锚元素=bangalore@RajtheStarter,下一步是将function getParameterByName添加到Demo2.html中,并通过过滤(如答案中的最后一个代码段)来使用它