单击ajax后删除类无法正常工作

时间:2018-09-18 19:17:13

标签: javascript html ajax

当我加载页面时,已删除类 boxAdRight

但是当我单击另一个TAB并返回到以前的TAB时,被删除的类“ boxAdRight”再次出现

这是我的导航

<ul class="nav nav-pills navTab">
 <li role="presentation" class="">
     <a aria-controls="data" role="tab" data-toggle="tab" data-name="info" aria-expanded="false">info</a>
 </li>

 <li role="presentation" class="active">
  <a aria-controls="data" role="tab" data-toggle="tab" data-name="servers" aria-expanded="true">watch</a>
  </li>

 <li role="presentation">
<a aria-controls="data" role="tab" data-toggle="tab" data-name="download"> download</a>
</li>

 <li role="presentation">
 <a aria-controls="data" role="tab" data-toggle="tab" data-name="selary"> selary</a>
 </li>
 <li role="presentation">
  <a aria-controls="data" role="tab" data-toggle="tab" data-name="comment"> comment</a>
 </li>
 </ul>

这是内容

<div class="panel-body">
   <div class="tab-content">
      <div class="tab-pane fade in active" id="data">
         <div class="getData">
            <div class="row">
               <div class="col-md-12 col-sm-12 col-xs-12">
                  <div class="servers">
                     <ul>
                        <li class="active" 
                           id="s_0"onclick="getServer(this.id,0);"> 
                           <i class="fa fa-video-camera"></i> server1
                        </li>
                     </ul>
                  </div>
               </div>
               <div class="col-md-3 col-sm-4 col-xs-12 fRight">
                  <div class="episodes boxAdRight">
                     <h2>episodes</h2>
                     <ul>
                        <li>
                           <a href="http://localhost/wordpress/newarticle13/">                                  episode 1</a>
                        </li>
                        <li class="active"><a href="http://localhost/wordpress/newarticle13/"> episode 2</a>
                        </li>
                     </ul>
                  </div>
               </div>
               <div class="col-md-9 col-sm-8 col-xs-12 fRight">
                  <div class="boxVideos">
                     <div class="getCode"><iframe src="https://*******" scrolling="no" frameborder="0" width="700" height="430" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
</div>

这是我使用的javascript,仅在加载页面时有效

  $(".getData").load(".row", function() {
  $('.episodes').removeClass('boxAdRight').trigger('click');

}); 

0 个答案:

没有答案