Html Li选择问题 [英] Html Li select issue

查看:94
本文介绍了Html Li选择问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的页面上有一个li列表,如

Hi,
I have a li list on my page like

<ul class="menu">
        <li><a  class="active" href="#about">About Me</a></li>
        <li><a href="#portfolio">My Portfolio</a></li>
        <li><a href="#contact">Contact Me</a></li>
      </ul>



我想更改我的style.css文件中的活动类。

我使用jquiry


and i want to change it class "active" which is present on my style.css file.
I use a jquiry

$('li').click(function () {
		    $(this).addClass('active').siblings().removeClass('active');
  //              $('li').removeClass();
  //             $(this).parent().addClass('active');
            });





但是当我使用这段代码时,每个tyme页面都被重新压缩并通过''a''标签转到另一页css没有变化的地方。

如何解决这个问题。请帮帮我。

谢谢,

Manojit



but when i use this code then each tyme page was refress and go to the other page by ''a'' tag where the css is not change.
how do i solve this problem.Please help me.
Thanks,
Manojit

推荐答案

' li')。click( function (){
('li').click(function () {


this )。addClass(' active')。siblings()。removeClass('' active');
//
(this).addClass('active').siblings().removeClass('active'); //


('li')。removeClass();
//
('li').removeClass(); //


这篇关于Html Li选择问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆