اريد تحويل كود بيور جافاسكريبت الي كود كوفي سكريبت
اريد تحويل كود بيور جافاسكريبت الي كود كوفي سكريبت
function Carousel(containerID) { this.container = document.getElementById(containerID) || document.body; this.slides = this.container.querySelectorAll(\'.carousel\'); this.total = this.slides.length - 1; this.current = 0; // start on slide 1 this.slide(this.current); } // NEXT Carousel.prototype.next = function (interval) { (this.current === this.total) ? this.current = 0 : this.current += 1; this.stop(); this.slide(this.current); if(typeof interval === \'number\' && (interval % 1) === 0) { var context = this; this.run = setTimeout(function() { context.next(interval); }, interval); } }; // PREVIOUS Carousel.prototype.prev = function (interval) { (this.current === 0) ? this.current = this.total : this.current -= 1; this.stop(); this.slide(this.current); if(typeof interval === \'number\' && (interval % 1) === 0) { var context = this; this.run = setTimeout(function() { context.prev(interval); }, interval); } }; // STOP PLAYING Carousel.prototype.stop = function () { clearTimeout(this.run); }; // SELECT SLIDE Carousel.prototype.slide = function (index) { if (index >= 0 && index this.total) { this.stop(); for (var s = 0; s this.total; s++) { if (s === index) { this.slides[s].style.display = \"inline-block\"; } else { this.slides[s].style.display = \'none\'; } } } else { alert(\"Index \" + index + \" doesn\'t exist. Available : 0 - \" + this.total); } };
احنا عاملين دورة في المضوع ده
https://5dmat-web.com/playlist/34
تابعها هتعرف اذاي تكتب coffee-script