响应式弹出层,支持各种不同特效
JavaScript Code
- <script>
- (function($){
- $(function(){
- $('[data-dialog]').on('click', function(e){
- var $this = $(e.target);
- $($this.data('dialog')).attr('class', 'popup '+$this.data('effect'));
- });
- });
- })(jQuery);
- $(document).ready(function(){
- $('.popup').popup({
- close: function(){
- $(this).find('.embed-container').empty();
- }
- });
- $(document).on('click', '[data-action="watch-video"]', function(e){
- e.preventDefault();
- var plugin = $('#popup-video.popup').data('popup');
- $('#popup-video.popup .embed-container').html(
- '<iframe src="'
- + e.currentTarget.href
- + '?autoplay=1" frameborder="0" allowfullscreen />'
- );
- plugin.open();
- });
- });
- </script>
原文地址:http://www.freejs.net/article_jquerywenzi_485.html