那個寫了很多代碼說沒彈出來的同學(xué),你寫錯了。
this._init=opt; 應(yīng)該為 this._init(opt);
this._init=opt; 應(yīng)該為 this._init(opt);
2016-11-20
https://github.com/cy0707/about_javascript/tree/master/cusScrollBar 這個是完整的代碼。
還有根據(jù)這問課程的總結(jié) https://github.com/cy0707/about_javascript/issues/29
還有瀏覽器的尺寸的文章總結(jié) https://github.com/cy0707/about_javascript/issues/17
希望大家一起交流
還有根據(jù)這問課程的總結(jié) https://github.com/cy0707/about_javascript/issues/29
還有瀏覽器的尺寸的文章總結(jié) https://github.com/cy0707/about_javascript/issues/17
希望大家一起交流
2016-11-18
.scroll-wrap .scroll-cont{
width:100%;
height:100%;
overflow: hidden;
padding:0 15px;
}
加一個height和overflow 效果調(diào)試出來,為了這2行代碼,調(diào)試了一個多小時,希望不要有人跟我犯一樣的錯誤
width:100%;
height:100%;
overflow: hidden;
padding:0 15px;
}
加一個height和overflow 效果調(diào)試出來,為了這2行代碼,調(diào)試了一個多小時,希望不要有人跟我犯一樣的錯誤
2016-11-18
對于內(nèi)容不夠的時候,那段js。其實(shí)有時候你不知有多少內(nèi)容,加起來很麻煩的。可以通過CSS設(shè)置.scroll-ol {
min-height: 100%;
}
這樣不需要矯正元素和那段js
min-height: 100%;
}
這樣不需要矯正元素和那段js
2016-11-18
getMaxScrollPosition: function() {
var self = this;
console.log(self.$cont.height()); //300
console.log(self.$cont[0].scrollHeight); //300
return Math.max(self.$cont.height(), self.$cont[0].scrollHeight) - self.$cont.height();
},
var self = this;
console.log(self.$cont.height()); //300
console.log(self.$cont[0].scrollHeight); //300
return Math.max(self.$cont.height(), self.$cont[0].scrollHeight) - self.$cont.height();
},
2016-11-18
dragContBarRate = self.getMaxScrollPosition()/self.getMaxSliderPosition();這個結(jié)果為0
2016-11-18
簡單分析下老師寫這些的原理。
function CusScrollBar(options){} 和CusScrollBar.prototype._init=function() 這個是采用了面向?qū)ο笾械模ńM合構(gòu)造函數(shù)和原型模式)的方法;
通過function CusScrollBar(options){} 傳參讓每個實(shí)例有自己的屬性;CusScrollBar.prototype._init 是原型,來確保所有實(shí)例都共享的方法
function CusScrollBar(options){} 和CusScrollBar.prototype._init=function() 這個是采用了面向?qū)ο笾械模ńM合構(gòu)造函數(shù)和原型模式)的方法;
通過function CusScrollBar(options){} 傳參讓每個實(shí)例有自己的屬性;CusScrollBar.prototype._init 是原型,來確保所有實(shí)例都共享的方法
2016-11-17
我能說我聽著聽著睡著了嗎,哈哈!不過老師講的確實(shí)很好,沒想到j(luò)Query竟然還有這么復(fù)雜......
2016-11-12