Built with RoyalSlider
Created
January 3, 2023 07:08
-
-
Save ichoake/65cf86ad1b36a11e1d710e65803c8e7c to your computer and use it in GitHub Desktop.
Responsive Video Gallery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="row clearfix"> | |
| <div class="col span_6 fwImage"> | |
| <div id="video-gallery" class="royalSlider videoGallery rsDefault"> | |
| <a class="rsImg" data-rsVideo="https://vimeo.com/45830194" href="https://b.vimeocdn.com/ts/319/715/319715493_640.jpg"> | |
| <div class="rsTmb"> | |
| <h5>Stanley Piano</h5> | |
| <span>by Digital Kitchen</span> | |
| </div> | |
| </a> | |
| <a class="rsImg" data-rsVideo="https://vimeo.com/44878206" href="https://b.vimeocdn.com/ts/311/891/311891198_640.jpg"> | |
| <div class="rsTmb"> | |
| <h5>Dubstep Dispute</h5> | |
| <span>by Fluxel Media</span> | |
| </div> | |
| </a> | |
| <a class="rsImg" data-rsVideo="https://vimeo.com/45778774" href="https://b.vimeocdn.com/ts/318/502/318502540_640.jpg"> | |
| <div class="rsTmb"> | |
| <h5>The Epic & The Beasts</h5> | |
| <span>by Sebastian Linda</span> | |
| </div> | |
| </a> | |
| <a class="rsImg" data-rsVideo="https://vimeo.com/41132461" href="https://b.vimeocdn.com/ts/284/709/284709146_640.jpg"> | |
| <div class="rsTmb"> | |
| <h5>Barcode Band</h5> | |
| <span>by Kang woon Jin</span> | |
| </div> | |
| </a> | |
| <a class="rsImg" data-rsVideo="https://vimeo.com/44388232" href="https://b.vimeocdn.com/ts/308/375/308375094_640.jpg"> | |
| <div class="rsTmb"> | |
| <h5>Samm Hodges Reel</h5> | |
| <span>by Animal</span> | |
| </div> | |
| </a> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function($) { | |
| var slider = $(".royalSlider").royalSlider({ | |
| arrowsNav: false, | |
| fadeinLoadedSlide: true, | |
| controlNavigationSpacing: 0, | |
| controlNavigation: 'thumbnails', | |
| thumbs: { | |
| autoCenter: false, | |
| fitInViewport: true, | |
| orientation: 'vertical', | |
| spacing: 0, | |
| paddingBottom: 0 | |
| }, | |
| keyboardNavEnabled: true, | |
| imageScaleMode: 'fill', | |
| imageAlignCenter:true, | |
| slidesSpacing: 0, | |
| loop: false, | |
| loopRewind: true, | |
| numImagesToPreload: 3, | |
| video: { | |
| autoHideArrows:true, | |
| autoHideControlNav:false, | |
| autoHideBlocks: true | |
| }, | |
| autoScaleSlider: true, | |
| autoScaleSliderWidth: 960, | |
| autoScaleSliderHeight: 450, | |
| imgWidth: 640, | |
| imgHeight: 360 | |
| }).data('royalSlider'); | |
| slider.ev.on('rsOnCreateVideoElement', function() { | |
| var f = slider.videoObj, | |
| url = f.attr('src').split('?')[0]; | |
| // postMessage | |
| function post(action, value) { | |
| var data = { method: action }; | |
| if (value) { | |
| data.value = value; | |
| } | |
| if (f && f[0] && f[0].contentWindow) f[0].contentWindow.postMessage(JSON.stringify(data), url); | |
| } | |
| // display event | |
| function onMessageReceived(e) { | |
| var data = JSON.parse(e.data); | |
| // Add listeners here | |
| if (data.event === 'ready') { | |
| // post('addEventListener', 'play'); | |
| // post('addEventListener', 'pause'); | |
| post('addEventListener', 'finish'); | |
| } | |
| if (data.event === 'finish') { | |
| if (data.event === 'finish') { | |
| setTimeout(function(){ | |
| var $slider = $('.royalslider'); | |
| slider.next(); | |
| console.log(slider.currSlideId); | |
| },2000); | |
| } | |
| } | |
| } | |
| if (window.addEventListener){ | |
| window.addEventListener('message', onMessageReceived, false); | |
| } else { // IE | |
| window.attachEvent('onmessage', onMessageReceived, false); | |
| } | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
| <script src="http://dimsemenov.com/plugins/royal-slider/royalslider/jquery.royalslider.min.js?v=9.3.6"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #video-gallery { | |
| width: 100%; | |
| } | |
| .videoGallery .rsTmb { | |
| padding: 20px; | |
| } | |
| .videoGallery .rsThumbs .rsThumb { | |
| width: 220px; | |
| height: 80px; | |
| border-bottom: 1px solid #2E2E2E; | |
| } | |
| .videoGallery .rsThumbs { | |
| width: 220px; | |
| padding: 0; | |
| } | |
| .videoGallery .rsThumb:hover { | |
| background: #000; | |
| } | |
| .videoGallery .rsThumb.rsNavSelected { | |
| background-color: #02874A; | |
| border-bottom:-color #02874A; | |
| } | |
| .sampleBlock { | |
| left: 3%; | |
| top: 1%; | |
| width: 100%; | |
| max-width: 400px; | |
| } | |
| .rsVideoContainer { | |
| width:100%; | |
| height:100%; | |
| overflow:hidden; | |
| display:block; | |
| float:left; | |
| } | |
| @media screen and (min-width: 0px) and (max-width: 500px) { | |
| .videoGallery .rsTmb { | |
| padding: 6px 8px; | |
| } | |
| .videoGallery .rsTmb h5 { | |
| font-size: 12px; | |
| line-height: 17px; | |
| } | |
| .videoGallery .rsThumbs.rsThumbsVer { | |
| width: 100px; | |
| padding: 0; | |
| } | |
| .videoGallery .rsThumbs .rsThumb { | |
| width: 100px; | |
| height: 47px; | |
| } | |
| .videoGallery .rsTmb span { | |
| display: none; | |
| } | |
| .videoGallery .rsOverflow, | |
| .royalSlider.videoGallery { | |
| height: 300px !important; | |
| } | |
| .sampleBlock { | |
| font-size: 14px; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link href="http://dimsemenov.com/plugins/royal-slider/royalslider/royalslider.css" rel="stylesheet" /> | |
| <link href="http://dimsemenov.com/plugins/royal-slider/royalslider/skins/default/rs-default.css?v=1.0.4" rel="stylesheet" /> | |
| <link href="http://dimsemenov.com/plugins/royal-slider/preview-assets/css/reset.css?v=1.0.4" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment