Set active link based on URL

后端 未结 6 1840
猫巷女王i
猫巷女王i 2021-01-29 05:58

If the URL ends: ?style=product I want to add a class of active to the li with the class of product

HTML:

<         


        
6条回答
  •  无人及你
    2021-01-29 06:05

    var style = '';
    if(style == 'product'){
        $('li.product').addClass('active');
    }
    

提交回复
热议问题