久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

js定位頁面某個(gè)位置

 實(shí)力決定地位 2018-07-12
  <ul>
            <li><a href="javascript:;" data-tab="eat">吃飯</a></li>
            <li><a href="javascript:;" data-tab="sleep">睡覺</a></li>
            <li><a href="javascript:;" data-tab="walk">逛街</a></li>
        </ul>
        <div>
            <div data-tab="eat" style="background:cyan; height:500px;">
                吃飯
            </div>
            <div data-tab="sleep" style="background:lightgreen;height:2000px;">
                睡覺
            </div>
            <div data-tab="walk" style="background:LightSalmon;height:1000px;">
                逛街
            </div>
        </div>
?
?
?[].slice.call(document.querySelectorAll('a')).forEach(function (el) {
                      el.addEventListener('click', function () {
                            var target = document.querySelector('div[data-tab=' + this.getAttribute('data-tab') + ']')
                            target.scrollIntoView(true);
                      })
             })
?
?Jquery

??$("#xxx").[0].scrollIntoView(true);
?
?不需要往跑的那么快,,緩慢過去代碼:
?
return cPageView.extend({
      pageid: 10320608681,
      hpageid: 10320608681,
      events: {
        "click .nav_list li ": "setHightLight",
      },
})
?
?
?-----------------------------------------------------------------------------
//設(shè)置標(biāo)簽選中,,并且滾動(dòng)到相應(yīng)的位置
     setHightLight: function (e) {
       var obj = $(e.currentTarget);
       var _tag = this.$el.find('.nav_list li');
       var $innerText = this.$el.find('.fsp_hd');
       var items = $(".fs_prd_wrap").find('.item');
       this.$el.find('.nav_list li').removeClass('current');
       var itemIndex = "";
       var objCurrent = [];
       obj.addClass('current');
       var scrollMove = function (scrollTo, time) {
         var scrollFrom = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
         var count = 0;
         var every = 10;
         scrollTo = parseInt(scrollTo);
         time /= every;
 
         var interval = setInterval(function () {
           count++;
           document.documentElement.scrollTop = document.body.scrollTop = (scrollTo - scrollFrom) / time * count + scrollFrom;
           if (count >= time) {
             clearInterval(interval);
           }
         }, every);
       };
       for (var i = 0; i < items.length; i++) {
         var self = this;
         items[i].index = i;
         if (obj.index() == items[i].index) {
           items.each(function () {
             var currentItem = $(this);
             // items[i].scrollIntoView(false);    
             scrollMove(items[i].offsetTop-75, 500);
           });
           
           // console.log(items[i].index);
         }
       }
     },
?
?
 
 
 
 
 
 
 

?

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多