Created
April 3, 2015 09:45
-
-
Save meded90/19f3182730ae1a01ebb2 to your computer and use it in GitHub Desktop.
динамическое загрузка ютуб роликов для мобайла
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="videowrapper"> | |
| <a href="{{ url }}" target="_blank"> | |
| <img src="{{ img-url }}" alt=""/> | |
| </a> | |
| </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
| .videowrapper { | |
| float: none; | |
| clear: both; | |
| width: 100%; | |
| position: relative; | |
| padding-bottom: 56.25%; | |
| padding-top: 25px; | |
| height: 0; | |
| position: relative | |
| a { | |
| cursor: pointer | |
| display: block | |
| left: 0 | |
| top: 0 | |
| position: absolute | |
| width: 100% | |
| height: 100% | |
| text-decoration: none !important | |
| } | |
| img { | |
| left: 0 | |
| top: 0 | |
| position: absolute | |
| width: 100% | |
| } | |
| iframe { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| } | |
| } |
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
| $('.videowrapper a').click(function () { | |
| var $this = $(this); | |
| var url = $this.attr('href'); | |
| $this.parent().append($('<iframe>').attr({ | |
| src: url+'?autoplay=1&rel=0&showinfo=0&border=0&iv_load_policy=3&modestbranding=1', | |
| frameborder: "0", | |
| allowfullscreen: null | |
| })); | |
| $this.remove() | |
| return false | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment