小编mik*_*ked的帖子

从网址中删除哈希

我有以下代码:

 jQuery(document).ready(function($) {
   $('.tab-title').on('click', function(e) {
      window.location.hash = $(this).attr('href');
      e.preventDefault();
    var _self = $(this);
    $('.tab').removeClass('active');
    _self.parent().addClass('active');
    });
});
Run Code Online (Sandbox Code Playgroud)

和我的PHP

<div class="tab active">
    <a href="<?php the_field('service_name');?>" class="tab-title"><?php the_field('service_title'); ?></a> 
</div> 
 <div class="tab-content">  
<h2><?php the_field('service_title'); ?> </h2>
    <p><?php the_field('service_desc'); ?></p>
    <p><?php the_field('service_area');?></p>
</div> 
Run Code Online (Sandbox Code Playgroud)

网站网址: mysite.com/services/marketing/#internet

问题是网站网址中包含的(#)。是否可以从网址中删除它?

hash jquery

0
推荐指数
1
解决办法
1939
查看次数

标签 统计

hash ×1

jquery ×1