<div class="slider" id="main-slider"><!-- --> <div class="slider-wrapper"><!-- --> <div class="slide">...</div><!-- slides --> <div class="slide">...</div> <div class="slide">...</div> </div> <div class="slider-nav"><!-- "" "" --> <button type="button" class="slider-previous"></button> <button type="button" class="slider-next"></button> </div> </div>
<div class="slider" id="main-slider"><!-- --> <div class="slider-wrapper"><!-- --> <img src="image1.jpg" alt="First" class="slide" /><!-- slides --> <img src="image2.jpg" alt="Second" class="slide" /> <img src="image3.jpg" alt="Third" class="slide" /> </div> <div class="slider-nav"><!-- "" "" --> <button type="button" class="slider-previous"></button> <button type="button" class="slider-next"></button> </div> </div>
<div class="slider" id="main-slider"><!-- --> <div class="slider-wrapper"><!-- --> <div class="slide" id="slide-1">...</div><!-- slides --> <div class="slide" id="slide-2">...</div> <div class="slide" id="slide-3">...</div> </div> <div class="slider-nav"><!— --> <a href="#slide-1">1</a> <a href="#slide-2">2</a> <a href="#slide-3">3</a> </div> </div>
<div class="slider" id="main-slider"><!-- --> <div class="slider-wrapper"><!-- --> <!-- slides --> <div class="slide" id="slide-1" data-image="image1.jpg"></div> <div class="slide" id="slide-2" data-image="image2.jpg"></div> <div class="slide" id="slide-3" data-image="image3.jpg"></div> </div> <!-- "" "" --> <div class="slider-nav"> <button type="button" class="slider-previous"></button> <button type="button" class="slider-next"></button> </div> <!-- --> <div class="slider-pagination"> <a href="#slide-1">1</a> <a href="#slide-2">2</a> <a href="#slide-3">3</a> </div> </div>
<ul class="slider-wrapper"><!-- --> <li class="slide" id="slide-1">...</li><!-- --> <li class="slide" id="slide-2">...</li> <li class="slide" id="slide-3">...</li> </ul>
CSS
:
<div class="slider" id="main-slider"><!-- --> <div class="slider-wrapper"><!-- --> <img src="image1.jpg" alt="First" class="slide" /><!-- slides --> <img src="image2.jpg" alt="Second" class="slide" /> <img src="image3.jpg" alt="Third" class="slide" /> </div> <div class="slider-nav"><!-- "" "" --> <button type="button" class="slider-previous"></button> <button type="button" class="slider-next"></button> </div> </div>
CSS
:
<div class="slider" id="main-slider"><!-- --> <div class="slider-wrapper"><!-- --> <img src="image1.jpg" alt="First" class="slide" /><!-- slides --> <img src="image2.jpg" alt="Second" class="slide" /> <img src="image3.jpg" alt="Third" class="slide" /> </div> <div class="slider-nav"><!-- "" "" --> <button type="button" class="slider-previous"></button> <button type="button" class="slider-next"></button> </div> </div>
CSS
:
<div class="slider" id="main-slider"><!-- --> <div class="slider-wrapper"><!-- --> <img src="image1.jpg" alt="First" class="slide" /><!-- slides --> <img src="image2.jpg" alt="Second" class="slide" /> <img src="image3.jpg" alt="Third" class="slide" /> </div> <div class="slider-nav"><!-- "" "" --> <button type="button" class="slider-previous"></button> <button type="button" class="slider-next"></button> </div> </div>
.slider { width: 1024px; overflow: hidden; } .slider-wrapper { width: 9999px; height: 683px; position: relative; transition: left 500ms linear; }
.slide { float: left; position: relative; width: 1024px; height: 683px; }
.slider-nav { height: 40px; width: 100%; margin-top: 1.5em; } .slider-nav button { border: none; display: block; width: 40px; height: 40px; cursor: pointer; text-indent: -9999em; background-color: transparent; background-repeat: no-repeat; } .slider-nav button.slider-previous { float: left; background-image: url(previous.png); } .slider-nav button.slider-next { float: right; background-image: url(next.png); }
.slider-nav { text-align: center; margin-top: 1.5em; } .slider-nav a { display: inline-block; text-decoration: none; border: 1px solid #ddd; color: #444; width: 2em; height: 2em; line-height: 2; text-align: center; } .slider-nav a.current { border-color: #000; color: #000; font-weight: bold; }
.slider { width: 1024px; margin: 2em auto; } .slider-wrapper { width: 100%; height: 683px; position: relative; /* */ } .slide { position: absolute; /* */ width: 100%; height: 100%; opacity: 0; /* */ transition: opacity 500ms linear; } /* */ .slider-wrapper > .slide:first-child { opacity: 1; }
function Slideshow( element ) { this.el = document.querySelector( element ); this.init(); } Slideshow.prototype = { init: function() { this.slides = this.el.querySelectorAll( ".slide" ); //... }, _slideTo: function( pointer ) { var currentSlide = this.slides[pointer]; //... } };
Slideshow.prototype = { init: function() { //... }, _slideTo: function( pointer ) { var n = pointer + 1; var currentSlide = this.el.querySelector( ".slide:nth-child(" + n + ")" ); //... } };
(function( $ ) { $.fn.slideshow = function( options ) { options = $.extend({ wrapper: ".slider-wrapper", slides: ".slide", //... speed: 500, easing: "linear" }, options); var slideTo = function( slide, element ) { var $currentSlide = $( options.slides, element ).eq( slide ); $( options.wrapper, element ). animate({ left: - $currentSlide.position().left }, options.speed, options.easing ); }; //... }; })( jQuery );
.slider-wrapper { position: relative; // transition: left 500ms linear; }
function Slideshow( element ) { this.el = document.querySelector( element ); this.init(); } Slideshow.prototype = { init: function() { this.wrapper = this.el.querySelector( ".slider-wrapper" ); this.slides = this.el.querySelectorAll( ".slide" ); //... }, _slideTo: function( pointer ) { var currentSlide = this.slides[pointer]; this.wrapper.style.left = "-" + currentSlide.offsetLeft + "px"; } };
(function( $ ) { $.fn.slideshow = function( options ) { options = $.extend({ wrapper: ".slider-wrapper", slides: ".slide", previous: ".slider-previous", next: ".slider-next", //... speed: 500, easing: "linear" }, options); var slideTo = function( slide, element ) { var $currentSlide = $( options.slides, element ).eq( slide ); $( options.wrapper, element ). animate({ left: - $currentSlide.position().left }, options.speed, options.easing ); }; return this.each(function() { var $element = $( this ), $previous = $( options.previous, $element ), $next = $( options.next, $element ), index = 0, total = $( options.slides ).length; $next.on( "click", function() { index++; $previous.show(); if( index == total - 1 ) { index = total - 1; $next.hide(); } slideTo( index, $element ); }); $previous.on( "click", function() { index--; $next.show(); if( index == 0 ) { index = 0; $previous.hide(); } slideTo( index, $element ); }); }); }; })( jQuery );
function Slideshow( element ) { this.el = document.querySelector( element ); this.init(); } Slideshow.prototype = { init: function() { this.wrapper = this.el.querySelector( ".slider-wrapper" ); this.slides = this.el.querySelectorAll( ".slide" ); this.previous = this.el.querySelector( ".slider-previous" ); this.next = this.el.querySelector( ".slider-next" ); this.index = 0; this.total = this.slides.length; this.actions(); }, _slideTo: function( pointer ) { var currentSlide = this.slides[pointer]; this.wrapper.style.left = "-" + currentSlide.offsetLeft + "px"; }, actions: function() { var self = this; self.next.addEventListener( "click", function() { self.index++; self.previous.style.display = "block"; if( self.index == self.total - 1 ) { self.index = self.total - 1; self.next.style.display = "none"; } self._slideTo( self.index ); }, false); self.previous.addEventListener( "click", function() { self.index--; self.next.style.display = "block"; if( self.index == 0 ) { self.index = 0; self.previous.style.display = "none"; } self._slideTo( self.index ); }, false); } };
(function( $ ) { $.fn.slideshow = function( options ) { options = $.extend({ wrapper: ".slider-wrapper", slides: ".slide", nav: ".slider-nav", speed: 500, easing: "linear" }, options); var slideTo = function( slide, element ) { var $currentSlide = $( options.slides, element ).eq( slide ); $( options.wrapper, element ). animate({ left: - $currentSlide.position().left }, options.speed, options.easing ); }; return this.each(function() { var $element = $( this ), $navigationLinks = $( "a", options.nav ); $navigationLinks.on( "click", function( e ) { e.preventDefault(); var $a = $( this ), $slide = $( $a.attr( "href" ) ); slideTo( $slide, $element ); $a.addClass( "current" ).siblings(). removeClass( "current" ); }); }); }; })( jQuery );
function Slider( element ) { this.el = document.querySelector( element ); this.init(); } Slider.prototype = { init: function() { this.links = this.el.querySelectorAll( "#slider-nav a" ); this.wrapper = this.el.querySelector( "#slider-wrapper" ); this.navigate(); }, navigate: function() { for ( var i = 0; i < this.links.length; ++i ) { var link = this.links[i]; this.slide( link ); } }, slide: function( element ) { var self = this; element.addEventListener( "click", function( e ) { e.preventDefault(); var a = this; self.setCurrentLink( a ); var index = parseInt( a.getAttribute( "data-slide" ), 10 ) + 1; var currentSlide = self.el.querySelector( ".slide:nth-child(" + index + ")" ); self.wrapper.style.left = "-" + currentSlide.offsetLeft + "px"; }, false); }, setCurrentLink: function(link) { var parent = link.parentNode; var a = parent.querySelectorAll( "a" ); link.className = "current"; for ( var j = 0; j < a.length; ++j ) { var cur = a[j]; if ( cur !== link ) { cur.className = ""; } } } };
link.classList.add( "current" );
var index = parseInt( a.dataset.slide, 10 ) + 1;
(function( $ ) { $.fn.slideshow = function( options ) { options = $.extend({ //... pagination: ".slider-pagination", //... }, options); $.fn.slideshow.index = 0; return this.each(function() { var $element = $( this ), //... $pagination = $( options.pagination, $element ), $paginationLinks = $( "a", $pagination ), //... $paginationLinks.on( "click", function( e ) { e.preventDefault(); var $a = $( this ), elemIndex = $a.index(); // DOM numerical index $.fn.slideshow.index = elemIndex; if( $.fn.slideshow.index > 0 ) { $previous.show(); } else { $previous.hide(); } if( $.fn.slideshow.index == total - 1 ) { $.fn.slideshow.index = total - 1; $next.hide(); } else { $next.show(); } slideTo( $.fn.slideshow.index, $element ); $a.addClass( "current" ). siblings().removeClass( "current" ); }); }); }; //... })( jQuery );
(function() { function Slideshow( element ) { this.el = document.querySelector( element ); this.init(); } Slideshow.prototype = { init: function() { this.wrapper = this.el.querySelector( ".slider-wrapper" ); this.slides = this.el.querySelectorAll( ".slide" ); this.previous = this.el.querySelector( ".slider-previous" ); this.next = this.el.querySelector( ".slider-next" ); this.navigationLinks = this.el.querySelectorAll( ".slider-pagination a" ); this.index = 0; this.total = this.slides.length; this.setup(); this.actions(); }, //... setup: function() { var self = this; //... for( var k = 0; k < self.navigationLinks.length; ++k ) { var pagLink = self.navigationLinks[k]; pagLink.setAttribute( "data-index", k ); // pagLink.dataset.index = k; } }, //... }; })();
actions: function() { var self = this; //... for( var i = 0; i < self.navigationLinks.length; ++i ) { var a = self.navigationLinks[i]; a.addEventListener( "click", function( e ) { e.preventDefault(); var n = parseInt( this.getAttribute( "data-index" ), 10 ); // var n = parseInt( this.dataset.index, 10 ); self.index = n; if( self.index == 0 ) { self.index = 0; self.previous.style.display = "none"; } if( self.index > 0 ) { self.previous.style.display = "block"; } if( self.index == self.total - 1 ) { self.index = self.total - 1; self.next.style.display = "none"; } else { self.next.style.display = "block"; } self._slideTo( self.index ); self._highlightCurrentLink( this ); }, false); } }
.slider-wrapper { width: 9999px; height: 683px; position: relative; transition: left 500ms linear; }
// - return this.each(function() { var $element = $( this ), total = $( options.slides ).length; //... $( options.slides, $element ).width( $( window ).width() ); $( options.wrapper, $element ).width( $( window ).width() * total ); //... });
// - return this.each(function() { var $element = $( this ), total = $( options.slides ).length; //... $( options.wrapper, $element ).width( $( options.slides ).eq( 0 ).width() * total ); //... });
// - Slideshow.prototype = { init: function() { this.wrapper = this.el.querySelector( ".slider-wrapper" ); this.slides = this.el.querySelectorAll( ".slide" ); //... this.total = this.slides.length; this.setDimensions(); this.actions(); }, setDimensions: function() { var self = this; // Viewport's width var winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var wrapperWidth = winWidth * self.total; for( var i = 0; i < self.total; ++i ) { var slide = self.slides[i]; slide.style.width = winWidth + "px"; } self.wrapper.style.width = wrapperWidth + "px"; }, //... }; // - Slideshow.prototype = { init: function() { this.wrapper = this.el.querySelector( ".slider-wrapper" ); this.slides = this.el.querySelectorAll( ".slide" ); //... this.total = this.slides.length; this.setDimensions(); this.actions(); }, setDimensions: function() { var self = this; var slideWidth = self.slides[0].offsetWidth; // Single slide's width var wrapperWidth = slideWidth * self.total; self.wrapper.style.width = wrapperWidth + "px"; }, //... };
.slider { width: 100%; overflow: hidden; position: relative; height: 400px; } .slider-wrapper { width: 100%; height: 100%; position: relative; } .slide { position: absolute; width: 100%; height: 100%; opacity: 0; } .slider-wrapper > .slide:first-child { opacity: 1; }
.slide { float: left; position: absolute; width: 100%; height: 100%; opacity: 0; transition: opacity 500ms linear; }
.slide { float: left; position: absolute; width: 100%; height: 100%; display: none; } .slider-wrapper > .slide:first-child { display: block; }
(function( $ ) { $.fn.slideshow = function( options ) { options = $.extend({ wrapper: ".slider-wrapper", previous: ".slider-previous", next: ".slider-next", slides: ".slide", nav: ".slider-nav", speed: 500, easing: "linear" }, options); var slideTo = function( slide, element ) { var $currentSlide = $( options.slides, element ).eq( slide ); $currentSlide. animate({ opacity: 1 }, options.speed, options.easing ). siblings( options.slides ). css( "opacity", 0 ); }; //... }; })( jQuery );
Slideshow.prototype = { //... _slideTo: function( slide ) { var currentSlide = this.slides[slide]; currentSlide.style.opacity = 1; for( var i = 0; i < this.slides.length; i++ ) { var slide = this.slides[i]; if( slide !== currentSlide ) { slide.style.opacity = 0; } } }, //... };
<div class="slider-wrapper"><!— --> <div class="slide"> <iframe src="https://player.vimeo.com/video/109608341?title=0&byline=0&portrait=0" width="1024" height="626" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div><!-- slides --> <div class="slide"> <iframe src="https://player.vimeo.com/video/102570343?title=0&byline=0&portrait=0" width="1024" height="576" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> <div class="slide"> <iframe src="https://player.vimeo.com/video/97620325?title=0&byline=0&portrait=0" width="1024" height="576" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> </div>
html, body { margin: 0; padding: 0; height: 100%; min-height: 100%; /* */ } .slider { width: 100%; overflow: hidden; height: 100%; min-height: 100%; /* */ position: absolute; /* */ } .slider-wrapper { width: 100%; height: 100%; /* */ position: relative; } .slide { float: left; position: absolute; width: 100%; height: 100%; } .slide iframe { display: block; /* */ position: absolute; /* */ width: 100%; height: 100%; /* */ }
(function( $ ) { $.fn.slideshow = function( options ) { options = $.extend({ slides: ".slide", speed: 3000, easing: "linear" }, options); var timer = null; // var index = 0; // var slideTo = function( slide, element ) { var $currentSlide = $( options.slides, element ).eq( slide ); $currentSlide.stop( true, true ). animate({ opacity: 1 }, options.speed, options.easing ). siblings( options.slides ). css( "opacity", 0 ); }; var autoSlide = function( element ) { // timer = setInterval(function() { index++; // 1 if( index == $( options.slides, element ).length ) { index = 0; // } slideTo( index, element ); }, options.speed); // , .animate() }; var startStop = function( element ) { element.hover(function() { // clearInterval( timer ); timer = null; }, function() { autoSlide( element ); // }); }; return this.each(function() { var $element = $( this ); autoSlide( $element ); startStop( $element ); }); }; })( jQuery );
.slide { transition: opacity 3s linear; /* 3 = 3000 */ }
(function() { function Slideshow( element ) { this.el = document.querySelector( element ); this.init(); } Slideshow.prototype = { init: function() { this.slides = this.el.querySelectorAll( ".slide" ); this.index = 0; // this.timer = null; // this.action(); this.stopStart(); }, _slideTo: function( slide ) { var currentSlide = this.slides[slide]; currentSlide.style.opacity = 1; for( var i = 0; i < this.slides.length; i++ ) { var slide = this.slides[i]; if( slide !== currentSlide ) { slide.style.opacity = 0; } } }, action: function() { var self = this; // Initializes the sequence self.timer = setInterval(function() { self.index++; // 1 if( self.index == self.slides.length ) { self.index = 0; // } self._slideTo( self.index ); }, 3000); // , CSS }, stopStart: function() { var self = this; // self.el.addEventListener( "mouseover", function() { clearInterval( self.timer ); self.timer = null; }, false); // self.el.addEventListener( "mouseout", function() { self.action(); }, false); } }; })();
$( "body" ).on( "keydown", function( e ) { var code = e.keyCode; if( code == 39 ) { // $next.trigger( "click" ); } if( code == 37 ) { // $previous.trigger( "click" ); } });
document.body.addEventListener( "keydown", function( e ) { var code = e.keyCode; var evt = new MouseEvent( "click" ); // if( code == 39 ) { // self.next.dispatchEvent( evt ); } if( code == 37 ) { // self.previous.dispatchEvent( evt ); } }, false);
(function( $ ) { $.fn.slideshow = function( options ) { options = $.extend({ //... callback: function() {} }, options); var slideTo = function( slide, element ) { var $currentSlide = $( options.slides, element ).eq( slide ); $currentSlide. animate({ opacity: 1 }, options.speed, options.easing, // options.callback( $currentSlide ) ). siblings( options.slides ). css( "opacity", 0 ); }; //... }; })( jQuery );
$(function() { $( "#main-slider" ).slideshow({ callback: function( slide ) { var $wrapper = slide.parent(); // $wrapper.find( ".slide-caption" ).hide(); slide.find( ".slide-caption" ).show( "slow" ); } }); });
(function() { function Slideshow( element, callback ) { this.callback = callback || function() {}; // Our callback this.el = document.querySelector( element ); this.init(); } Slideshow.prototype = { init: function() { //... this.slides = this.el.querySelectorAll( ".slide" ); //... //... }, _slideTo: function( slide ) { var self = this; var currentSlide = self.slides[slide]; currentSlide.style.opacity = 1; for( var i = 0; i < self.slides.length; i++ ) { var slide = self.slides[i]; if( slide !== currentSlide ) { slide.style.opacity = 0; } } setTimeout( self.callback( currentSlide ), 500 ); // } }; // })();
document.addEventListener( "DOMContentLoaded", function() { var slider = new Slideshow( "#main-slider", function( slide ) { var wrapper = slide.parentNode; // var allSlides = wrapper.querySelectorAll( ".slide" ); var caption = slide.querySelector( ".slide-caption" ); caption.classList.add( "visible" ); for( var i = 0; i < allSlides.length; ++i ) { var sld = allSlides[i]; var cpt = sld.querySelector( ".slide-caption" ); if( sld !== slide ) { cpt.classList.remove( "visible" ); } } }); });
<div class="slider" id="main-slider"><!-- --> <div class="slider-wrapper"><!-- --> </div> <div class="slider-nav"><!-- "" "" --> <button class="slider-previous"> </button> <button class="slider-next"> </button> </div> <div id="spinner"></div><!— --> </div>
#spinner { border-radius: 50%; border: 2px solid #000; height: 80px; width: 80px; position: absolute; top: 50%; left: 50%; margin: -40px 0 0 -40px; } #spinner:after { content: ''; position: absolute; background-color: #000; top:2px; left: 48%; height: 38px; width: 2px; border-radius: 5px; -webkit-transform-origin: 50% 97%; transform-origin: 50% 97%; -webkit-animation: angular 1s linear infinite; animation: angular 1s linear infinite; } @-webkit-keyframes angular { 0%{-webkit-transform:rotate(0deg);} 100%{-webkit-transform:rotate(360deg);} } @keyframes angular { 0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);} } #spinner:before { content: ''; position: absolute; background-color: #000; top:6px; left: 48%; height: 35px; width: 2px; border-radius: 5px; -webkit-transform-origin: 50% 94%; transform-origin: 50% 94%; -webkit-animation: ptangular 6s linear infinite; animation: ptangular 6s linear infinite; } @-webkit-keyframes ptangular { 0%{-webkit-transform:rotate(0deg);} 100%{-webkit-transform:rotate(360deg);} } @keyframes ptangular { 0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);} }
(function( $ ) { $.fn.slideshow = function( options ) { options = $.extend({ wrapper: ".slider-wrapper", //... loader: "#spinner", //... limit: 5, username: "learncodeacademy" }, options); //... var getVideos = function() { // YouTube var ytURL = "https://gdata.youtube.com/feeds/api/videos?alt=json&author=" + options.username + "&max-results=" + options.limit; $.getJSON( ytURL, function( videos ) { // JSON $( options.loader ).hide(); // var entries = videos.feed.entry; var html = ""; for( var i = 0; i < entries.length; ++i ) { // HTML var entry = entries[i]; var idURL = entry.id.$t; var idVideo = idURL.replace( "http://gdata.youtube.com/feeds/api/videos/", "" ); var ytEmbedURL = "https://www.youtube.com/embed/" + idVideo + "?rel=0&showinfo=0&controls=0"; html += "<div class='slide'>"; html += "<iframe src='" + ytEmbedURL + "' frameborder='0' allowfullscreen></iframe>"; html += "</div>"; } $( options.wrapper ).html( html ); // - }); }; return this.each(function() { //... getVideos(); // - }); }; })( jQuery );
(function() { function Slideshow( element ) { this.el = document.querySelector( element ); this.init(); } Slideshow.prototype = { init: function() { this.wrapper = this.el.querySelector( ".slider-wrapper" ); this.loader = this.el.querySelector( "#spinner" ); //... this.limit = 5; this.username = "learncodeacademy"; }, _getJSON: function( url, callback ) { callback = callback || function() {}; var request = new XMLHttpRequest(); request.open( "GET", url, true ); request.send( null ); request.onreadystatechange = function() { if ( request.status == 200 && request.readyState == 4 ) { var data = JSON.parse( request.responseText ); // JSON object callback( data ); } else { console.log( request.status ); } }; }, //... }; })();
(function() { function Slideshow( element ) { this.el = document.querySelector( element ); this.init(); } Slideshow.prototype = { init: function() { this.wrapper = this.el.querySelector( ".slider-wrapper" ); this.loader = this.el.querySelector( "#spinner" ); //... this.limit = 5; this.username = "learncodeacademy"; this.actions(); }, _getJSON: function( url, callback ) { callback = callback || function() {}; var request = new XMLHttpRequest(); request.open( "GET", url, true ); request.send( null ); request.onreadystatechange = function() { if ( request.status == 200 && request.readyState == 4 ) { var data = JSON.parse( request.responseText ); // JSON object callback( data ); } else { console.log( request.status ); } }; }, //... getVideos: function() { var self = this; // YouTube var ytURL = "https://gdata.youtube.com/feeds/api/videos?alt=json&author=" + self.username + "&max-results=" + self.limit; self._getJSON( ytURL, function( videos ) { // JSON var entries = videos.feed.entry; var html = ""; self.loader.style.display = "none"; // for( var i = 0; i < entries.length; ++i ) { // HTML var entry = entries[i]; var idURL = entry.id.$t; var idVideo = idURL.replace( "http://gdata.youtube.com/feeds/api/videos/", "" ); var ytEmbedURL = "https://www.youtube.com/embed/" + idVideo + "?rel=0&showinfo=0&controls=0"; html += "<div class='slide'>"; html += "<iframe src='" + ytEmbedURL + "' frameborder='0' allowfullscreen></iframe>"; html += "</div>"; } self.wrapper.innerHTML = html; // - }); }, actions: function() { var self = this; self.getVideos(); // - } }; })();
Source: https://habr.com/ru/post/251783/
All Articles