// Á¦ÀÛÀÚ : ¾Æ½ºÇǸ° // Á¦ÀÛÀÚ ºí·Î±× : http://cleanup.tistory.com // ¼Ò½º ÁÖ¼Ò : http://cleanup.tistory.com/8 // ÀÚÀ¯·Ó°Ô »ç¿ë °¡´ÉÇϽøç, ¼Ò½º ÁÖ¼Ò·Î ¿À¼Å¼­ ´ñ±Û·Î Æò°¡¸¸ ³²°Ü ÁÖ¼¼¿ä function GoodsScroll() { this.Name = "GScroll"; this.GoodsName = "Goods_Scroll"; this.Speed = 70; this.GoodsSetTime = null; this.LiBox_Num = 4; // Çѹø¿¡ ½ºÅ©·ÑÇÒ »óǰ °¹¼ö this.LiBox_HiddenNum = 4; // Çѹø¿¡ ³ëÃâÇÒ »óǰ °¹¼ö this.GoodsSetting(); // ÃʱⰪ this.DivSize(); // ³ëÃâµÉ »óǰÀÇ ³ÐÀÌ ³ôÀ̰ª this.GoodlsArrange(); // »óǰ ¼ø¼­´ë·Î Áø¿­Çϱâ this.doMove = function(state) { this.sState = state; if(this.sState == "next") { this._nextFrame(); } else if(this.sState == "prev") { this._prevFrame(); } } } GoodsScroll.prototype.GoodsSetting = function() { this.GoodsBox = document.getElementById(this.GoodsName); this.OlBox = this.GoodsBox.getElementsByTagName("ol")[0]; this.LiBox = this.OlBox.getElementsByTagName("li"); this.LiBox_Length = this.LiBox.length; // »óǰÀÇ ÃÑ °¹¼ö this.LiBox_Width = this.LiBox.item(0).offsetWidth; // »óǰ ÇѰ³ÀÇ ³ÐÀÌ this.LiBox_Left = new Array(); // °¢ »óǰÀÇ À§Ä¡°ªÀ» ÀúÀåÇÏ´Â ¹è¿­ } GoodsScroll.prototype.DivSize = function() { this.DivBox = this.LiBox.item(0).getElementsByTagName("div"); this.DivBox_Height = 0; for ( var i=0; i < this.DivBox.length; i++ ) { this.DivBox_Height = this.DivBox_Height + this.DivBox.item(i).offsetHeight; } this.GoodsBox.style.height = this.DivBox_Height + 20 + "px"; this.GoodsBox.style.width = this.LiBox_Width * this.LiBox_HiddenNum + "px"; } GoodsScroll.prototype.GoodlsArrange = function() { this.Default_left = -(this.LiBox_Num * this.LiBox_Width); // »óǰÀÇ Ãʱâ À§Ä¡°ª for ( var i=0; i < this.LiBox_Length; i++ ) { this.LiBox_Left[i] = this.Default_left + ( i * this.LiBox_Width ); this.LiBox.item(i).style.left = this.LiBox_Left[i] + "px"; } this.Last_Left = this.LiBox_Left[this.LiBox_Length-1]; } GoodsScroll.prototype._nextFrame = function() { for ( var i=0; i