Created
March 11, 2015 13:25
-
-
Save davinmsu/68bd8290052904a746f7 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
| (function() { | |
| $(function() { | |
| var $banner, closeBanner, initBanner, showBanner; | |
| $banner = $('<div id="interactive-banner" />'); | |
| window.$banner = $banner; | |
| $banner.stylesheet = $('<style type="text/css">#interactive-banner{position:fixed;top:0;left:0;width:100%;height:100%;display:none;background:#fff}#interactive-banner>.close{background: url("http://cdn.vmet.ro/html5_bnr/test/close.svg") no-repeat;background-size:contain;position:absolute;top:10px;right:10px;width:20px;height:20px}</style>'); | |
| $banner.closer = $('<div class="close" />'); | |
| $banner.content = $('<div class="content" />'); | |
| $('head').append($banner.stylesheet); | |
| $banner.append($banner.closer, $banner.content).appendTo('body'); | |
| showBanner = function() { | |
| $('body').css({ | |
| overflow: 'hidden' | |
| }); | |
| $banner.css({ | |
| display: 'block' | |
| }); | |
| return $banner.trigger('activate'); | |
| }; | |
| closeBanner = function() { | |
| $('body').css({ | |
| overflow: '' | |
| }); | |
| return $banner.remove(); | |
| }; | |
| initBanner = function(url) { | |
| $banner.closer.on('click', function() { | |
| return closeBanner(); | |
| }); | |
| return $.ajax({ | |
| url: url | |
| }).done(function(data) { | |
| $banner.content.html(data); | |
| return showBanner(); | |
| }); | |
| }; | |
| return initBanner('http://cdn.vmet.ro/html5_bnr/test/banner.html'); | |
| }); | |
| }).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment