最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

bootstrap datetimepicker控件位置異常的解決方法

 更新時間:2017年11月23日 11:53:40   作者:_rdOfJava  
這篇文章主要為大家詳細(xì)介紹了bootstrap datetimepicker控件位置異常的解決方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下

今天在寫畢設(shè)的時候,用到了bootstrap-datetimepicker作為日期控件。

在git上clone下最新的代碼,運行demo,發(fā)現(xiàn)控件區(qū)域整體下移1000px左右。

作為一個準(zhǔn)備拿來就用的后臺程序猿,此刻我的內(nèi)心是崩潰的…

百度了很久,沒有找到對應(yīng)的解決方案,于是自己動手去源碼修改。

最終解決方案:

打開源碼,的bootstrap-datetimepicker.js文件

line 527行,打開這一段注釋即可

 /*if (this.pickerPosition == 'top-left' || this.pickerPosition == 'top-right') {
    top = offset.top - this.picker.outerHeight();
   } else {
    top = offset.top + this.height;
   }*/

如果看著還是不是很舒服的話,建議注釋掉line 533 - line 544

top = top - containerOffset.top + 169;
left = left - containerOffset.left + 210;

為什么要這樣解決呢?

  place: function () {
   if (this.isInline) return;

   if (!this.zIndex) {
    var index_highest = 0;
    $('div').each(function () {
     var index_current = parseInt($(this).css('zIndex'), 10);
     if (index_current > index_highest) {
      index_highest = index_current;
     }
    });
    this.zIndex = index_highest + 10;
   }

   var offset, top, left, containerOffset;
   if (this.container instanceof $) {
    containerOffset = this.container.offset();
   } else {
    containerOffset = $(this.container).offset();
   }

   if (this.component) {
    offset = this.component.offset();
    left = offset.left;
    if (this.pickerPosition == 'bottom-left' || this.pickerPosition == 'top-left') {
     left += this.component.outerWidth() - this.picker.outerWidth();
    }
   } else {
    offset = this.element.offset();
    left = offset.left;
   }

   var bodyWidth = document.body.clientWidth || window.innerWidth;
   if (left + 220 > bodyWidth) {
    left = bodyWidth - 220;
   }

   /*if (this.pickerPosition == 'top-left' || this.pickerPosition == 'top-right') {
    top = offset.top - this.picker.outerHeight();
   } else {
    top = offset.top + this.height;
   }*/

   top = top - containerOffset.top + 169;
   left = left - containerOffset.left + 210;

   this.picker.css({
    top:  top,
    left:  left,
    zIndex: this.zIndex
   });
  },

上面就是相關(guān)的源碼,可以看到,注釋了line 527行之后,在后面引用了一個未初始化過的top變量

嗯… 這是一個沒經(jīng)過測試就提交的小BUG…

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

汉源县| 安庆市| 乌拉特后旗| 漠河县| 茶陵县| 湘乡市| 黄陵县| 军事| 清徐县| 垣曲县| 乾安县| 汾阳市| 兰西县| 女性| 华亭县| 和硕县| 湖州市| 大厂| 平湖市| 吴忠市| 云霄县| 石棉县| 当雄县| 吉木乃县| 堆龙德庆县| 如皋市| 新野县| 嘉祥县| 开江县| 莱阳市| 石城县| 新泰市| 神池县| 民乐县| 广安市| 吴川市| 宁陕县| 宁乡县| 永和县| 湘阴县| 津南区|