<section class="big-background"> //Big Background Content here </section> <div class="wrapper"> <section class="about-section"> //About Section Content here </section> <section class="small-background-section"> //Small Background Section Content here </section> </div>
<section class="big-background"> <a id="bgndVideo" class="player" data-property="{videoURL:'http://www.youtube.com/watch?v=PKGjG_ZhF-A',containment:'body',autoPlay:true, mute:true, startAt:0, opacity:1}"></a> <div class="pattern"></div> <div class="big-background-container"> <h1 class="big-background-title">YOUTUBE</h1> <div class="divider"></div> <h1 id="colorize"> </h1> <a href="http://designmodo.com/video-background-website/" class="big-background-btn"> </a> </div> </section> <div class="wrapper"> <section class="about-section"> <div class="about-section-container"> <h2 class="about-section-title"> YouTube </h2> <p> , ? <br/> ! jQuery MB.YTPlayer, jQuery, YouTube .<br/> HTML . !</p> <a href="https://github.com/pupunzi/jquery.mb.YTPlayer" target="_blank" class="about-section-btn"> </a> </div> </section> <section class="small-background-section"> <div class="pattern"></div> <div class="small-background-container"> <h2 class="small-background-title"><span> </span></h2> <ul class="socials"> <li><a href="https://www.facebook.com/designmodo" target="_blank"><i class="fa fa-facebook-square fa-3x"></i></a></li> <li><a href="https://twitter.com/Designmodo" target="_blank"><i class="fa fa-twitter-square fa-3x"></i></a></li> <li><a href="https://plus.google.com/+Designmodo" target="_blank"><i class="fa fa-google-plus-square fa-3x"></i></a></li> </ul> </div> </section>
<a id="bgndVideo" class="player" data-property="{videoURL:'https://www.youtube.com/watch?v=0WhoCe_2jpc', containment:'body',autoPlay:true, mute:true, startAt:0, opacity:1}"></a>
html { height:100% } body { font:15px/23px 'Raleway',sans-serif; margin:0; padding:0; height:100%; width:100%; -webkit-font-smoothing:antialiased; -webkit-text-size-adjust:100% } p { font-size:20px; line-height:140%; text-align:center } ul li { display:inline-block; list-style:none; padding-right: 10px; }
.wrapper { z-index:600; position:relative } .pattern { background-image:url(../images/pattern.png); background-repeat: repeat; background-attachment:scroll; width:100%; height:100%; position:absolute; top:0; left:0 } .divider { background-image:url(../images/divider.png); display:block; width:300px; height:35px; margin:10px auto } #colorize { color:#f1c40f; font-family:'Lato',sans-serif; font-size:40px }
.big-background { z-index:550; text-align:center; height:100%; min-height:100%; position:relative; overflow:hidden } .big-background .big-background-container { width:830px; max-width:100%; display:inline-block; position:absolute; top:50%; left:50%; -webkit-transform:translate(-50%,-50%); -moz-transform:translate(-50%,-50%); -ms-transform:translate(-50%,-50%); -o-transform:translate(-50%,-50%); transform:translate(-50%,-50%) } .big-background-title { font-family:'Raleway',sans-serif; font-size:78px; color:#fff; font-weight:300; text-transform:uppercase; text-align:center; margin-bottom:22px; padding-top:20px; display:inline-block; background-attachment:scroll; background-repeat:repeat-x; background-position:top center } a.big-background-btn { font-family:'Lato',sans-serif; font-size:13px; text-transform:uppercase; text-decoration:none; color:#fff; background:transparent; border:2px solid #fff; padding:10px 14px; cursor:pointer; letter-spacing:2px; text-align:center; display:inline-block; -webkit-transition:.4s background ease; -moz-transition:.4s background ease; -o-transition:.4s background ease; transition:.4s background ease; } .big-background-btn:hover { color:#fff; background:rgba(255,255,255,0.20) } .big-background-default-image { background:url(../images/sunset.jpg); background-repeat:no-repeat; background-position:center center; background-size:cover; width:100%; height:100%; z-index:0; backface-visibility:hidden }
.about-section { font-family:'Lato',sans-serif; color:#7f8c8d; background:#fff; padding:60px 20px } .about-section-container { text-align:center; padding-bottom:50px } .about-section-title { font-family:'Raleway',sans-serif; font-size:40px; background:#fff; color:#3d566e; padding:0 35px; margin-bottom:22px; background-attachment:scroll; background-repeat:repeat-x; background-position:center center; text-transform:uppercase } a.about-section-btn { font-family:'Lato',sans-serif; font-size:13px; text-transform:uppercase; text-decoration:none; color:#34495e; background:transparent; border:2px solid #34495e; padding:10px 14px; cursor:pointer; letter-spacing:2px; text-align:center; display:inline-block; -webkit-transition:.4s background ease; -moz-transition:.4s background ease; -o-transition:.4s background ease; transition:.4s background ease; } .about-section-btn:hover { color:#fff; background: #34495e; }
.small-background-section { font-family:'Raleway',sans-serif; padding:100px 0; position:relative; width:100%; overflow:hidden } .small-background-container { position:relative; text-align:center } .small-background-title { font-size:40px; color:#f1c40f; font-weight:300; z-index:10; display:inline-block; text-transform:uppercase; margin-bottom:20px; margin-top: 20px; position:relative; background-attachment:scroll; background-repeat:repeat-x; background-position:top center } .socials a { color:#fff } .socials a:hover { color:#bdc3c7 }
@media screen and (max-width: 768px) { .about-section-title { line-height:1 } } @media screen and (max-width: 480px) { .big-background-title { font-size:58px } .small-background-title { line-height:1 } /*.player{ display: none;} -> If you want to remove the video bg on a specific viewport w/o plugin*/ } @media screen and (max-width: 360px) { .big-background-title,#colorize { line-height:1 } } @media screen and (max-width: 320px) { .small-background-title { font-size:30px } }
$(function(){ $(".player").mb_YTPlayer(); });
@media screen and (max-width: 480px) { .player{ display: none; } }
(function($) { $(document).ready(function() { var is_mobile = false; if( $('.player').css('display')=='none') { is_mobile = true; } if (is_mobile == true) { //Conditional script here $('.big-background, .small-background-section').addClass('big-background-default-image'); }else{ $(".player").mb_YTPlayer(); } }); })(jQuery);
(function($) { $(document).ready(function() { //Device.js will check if it is Tablet or Mobile - http://matthewhudson.me/projects/device.js/ if (!device.tablet() && !device.mobile()) { $(".player").mb_YTPlayer(); } else { //jQuery will add the default background to the preferred class $('.big-background, .small-background-section').addClass( 'big-background-default-image'); } }); })(jQuery);
Source: https://habr.com/ru/post/249553/
All Articles