cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

js update the dom, iscroll invalid? #1099

Closed finnome closed 8 years ago

finnome commented 8 years ago
    $(function() {
          let tabs = $('.weui_tab_content');
          tabs.removeClass('weui_tab_content_active');
         $(this).addClass('weui_tab_content_active');
    });

   dom is:  
   <div class="weui_tab_content weui_tab_content_active">
          <div class="x_wrap">
               <div class="x_scroll">
                     <ul ng-init="dataset=['蔬菜', '禽蛋肉类', '河鲜海鲜', '米油', '店铺', '野味', '村味', '村味1', '村味2', '村味12', '村味24']">
                         <li ng-repeat="x in dataset">{{x}}</li>
                    </ul>
                </div>
          </div>
   </div>

<script>
  var myScroll;
  $(function() {
    console.log('hello fuck');
    myScroll = new IScroll('.x_wrap', { scrollX: true, scrollY: false, mouseWheel: true });
  });
  document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
</script>

when I remove the code of $(function() { let tabs = $('.weui_tab_content'); tabs.removeClass('weui_tab_content_active'); $(this).addClass('weui_tab_content_active'); }); It's ok....

finnome commented 8 years ago

scroll.refresh() when update the dom