文本在設置overflow為hidden之后檢測到的元素內(nèi)容高度就是300然后文本可滾動高度就是0了
getMaxScrollPosition:function () {
? ?var self = this;
? ?console.log("調(diào)用getMaxScrollPosition");
? ?//獲取滾動條內(nèi)容高度:可視區(qū)和元素內(nèi)容高度的最大值
? ?console.log("self.$cont.height()"+self.$cont.height());
? ?console.log("self.$cont[0].scrollHeight"+self.$cont[0].scrollHeight)
? ?return Math.max(self.$cont.height(),self.$cont[0].scrollHeight)-self.$cont.height();
? ?//內(nèi)容可滾動的距離為:文本內(nèi)容高度-可視區(qū)內(nèi)容高度,當文本內(nèi)容高度小于可視區(qū)時可移動距離為0
},
2017-11-18
厲害了,我的哥