diff --git a/README.md b/README.md index b0e2cac..fad8774 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,11 @@ jQuery Modal Window Effects with transitions CSS3. See the [project page](http:/ ## Changelog: +### Version 1.1.2 - 2013/12/10 +* Bug fix on callback that fires once is closed in the overlay. +* Bug fix IE8 when open the modal. +* Changes in the sample page. + ### Version 1.1.1 - 2013/11/05 * Bug fix on the position scrollbar. diff --git a/custombox.jquery.json b/custombox.jquery.json index 92812ca..d0de615 100644 --- a/custombox.jquery.json +++ b/custombox.jquery.json @@ -17,7 +17,7 @@ "jquery", "responsive" ], - "version": "1.1.0", + "version": "1.1.2", "author": { "name": "Julio De La Calle", "email": "juliodlcp@gmail.com", diff --git a/demo/css/demo.css b/demo/css/demo.css index 3a9d97a..6b98e84 100755 --- a/demo/css/demo.css +++ b/demo/css/demo.css @@ -37,6 +37,9 @@ code { code { padding: 0; } +.code .container { + width: 100%; +} .clearfix:after { content: "."; display: block; @@ -77,7 +80,7 @@ code { right: -50px; top: -65px; left: auto; - z-index: 2; + z-index: 3; } a.download { font-size: 22px; @@ -153,7 +156,6 @@ h3 em { top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); - -moz-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } @@ -171,7 +173,6 @@ h3 em { border: none; } - /* ---------------------------- Modal Example 4 @@ -190,11 +191,9 @@ h3 em { .custombox-close.customslide .custombox-modal-content { -webkit-transform: scale(2); -ms-transform: scale(2); - -o-transform: scale(2); transform: scale(2); opacity: 1; -webkit-transition-property: all; -ms-transition-property: all; - -o-transition-property: all; transition-property: all !important; } \ No newline at end of file diff --git a/index.html b/index.html index 48c8fb9..36fa969 100755 --- a/index.html +++ b/index.html @@ -2,7 +2,6 @@ - jQuery Custombox :: dixso.net @@ -16,11 +15,10 @@ - - + @@ -31,10 +29,20 @@ + + + + + Fork me on GitHub
- Download + Download

Please note: these animations only works as intended in browsers that support the respective CSS properties.
Internet Explorer 8 and 9 works, but without animations.

Modern browsers only! @@ -518,14 +526,6 @@

jQuery Custombox

if ( $(window).width() > 360 ) { SyntaxHighlighter.all(); } - - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - - ga('create', 'UA-43787495-1', 'dixso.github.io'); - ga('send', 'pageview'); diff --git a/src/jquery.custombox.css b/src/jquery.custombox.css index 0f1e065..67bf62c 100755 --- a/src/jquery.custombox.css +++ b/src/jquery.custombox.css @@ -1,5 +1,5 @@ /* - * jQuery Custombox v1.1.1 - 2013-11-05 + * jQuery Custombox v1.1.2 - 2013/12/10 * jQuery Modal Window Effects. * http://dixso.github.io/custombox/ * (c) 2013 Julio De La Calle - http://dixso.net - @dixso9 diff --git a/src/jquery.custombox.js b/src/jquery.custombox.js index f6aeb76..0730fcc 100755 --- a/src/jquery.custombox.js +++ b/src/jquery.custombox.js @@ -1,5 +1,5 @@ /* - * jQuery Custombox v1.1.1 - 2013-11-05 + * jQuery Custombox v1.1.2 - 2013/12/10 * jQuery Modal Window Effects. * http://dixso.github.io/custombox/ * (c) 2013 Julio De La Calle - http://dixso.net - @dixso9 @@ -246,10 +246,18 @@ modal.style.height = tmpSize.height + 'px'; } - var position = { - 'margin-left': - modal.offsetWidth / 2 + 'px', - 'width': modal.offsetWidth + 'px' - }; + var offw = modal.offsetWidth, + position = { + 'margin-left': - offw / 2 + 'px', + 'width': offw + 'px' + }; + + // IE8 not supported: translateY(-50%). + if ( obj._isIE() ) { + var offh = modal.offsetHeight; + position['margin-top'] = - offh / 2 + 'px'; + position['height'] = offh + 'px'; + } // If position top? if ( obj.settings.position !== null && obj.settings.position.indexOf('top') !== -1 ) { @@ -261,9 +269,9 @@ // Check if scrollbar is visible. var wsize = { - width: 'innerWidth' in window ? window.innerWidth : document.documentElement.offsetWidth, - height: 'innerHeight' in window ? window.innerHeight : document.documentElement.offsetHeight - }; + width: 'innerWidth' in window ? window.innerWidth : document.documentElement.offsetWidth, + height: 'innerHeight' in window ? window.innerHeight : document.documentElement.offsetHeight + }; if ( !obj.settings.scrollbar ) { if ( modal.offsetHeight < wsize.height && body.offsetHeight > wsize.height ) { @@ -458,10 +466,8 @@ // Check if callback 'close'. if ( obj.settings.close && typeof obj.settings.close === 'function' ) { obj.settings.close( undefined !== arguments[0] ? arguments[0] : '' ); - } - - // Check if callback 'close' when the method is public. - if ( typeof modal !== 'undefined' && modal.getAttribute('data-' + cb) !== null ) { + } else if ( typeof modal !== 'undefined' && modal.getAttribute('data-' + cb) !== null ) { + // Check if callback 'close' when the method is public. var onClose = modal.getAttribute('data-' + cb), onCloseLaunch = new Function ( 'onClose', 'return ' + onClose )(onClose); onCloseLaunch(); @@ -540,7 +546,6 @@ // Listener on element close. if ( obj.settings.eClose !== null && typeof obj.settings.eClose === 'string' && obj.settings.eClose.charAt(0) === '#' || typeof obj.settings.eClose === 'string' && obj.settings.eClose.charAt(0) === '.' && document.querySelector(obj.settings.eClose) ) { document.querySelector(obj.settings.eClose).addEventListener('click', function () { - console.log('entro'); obj._close(); }, false ); } @@ -570,10 +575,21 @@ _create: function ( attr, styles, element ) { var div = ( element === undefined || element === null ? document.createElement('div') : element ); + // Compatibility ECMAScript 5 Objects and Properties. + Object.keys = Object.keys || function( o ) { + var result = []; + for ( var name in o ) { + if ( o.hasOwnProperty(name) ) { + result.push(name); + } + } + return result; + }; + if ( attr !== null && Object.keys(attr).length !== 0 ) { // Add the id. if ( attr.id !== null ) { - div.id = cb + '-' + attr.id + new Date().getTime(); + div.id = cb + '-' + attr.id; } // Add the class. @@ -588,7 +604,13 @@ if ( styles.hasOwnProperty(obj) ) { // Insert browser dependent styles. if ( this._isIE() ) { - div.style[obj] = styles[obj]; + var camelCase = obj.split('-'); + if ( camelCase.length > 1 ) { + camelCase = camelCase[0] + camelCase[1].replace(/(?:^|\s)\w/g, function( match ) { + return match.toUpperCase(); + }); + } + div.style[camelCase] = styles[obj]; } else { div.style.setProperty( obj, styles[obj], null ); } @@ -640,10 +662,11 @@ } }, _zIndex: function () { - var elems = document.getElementsByTagName('*'), + var d = document, + elems = d.getElementsByTagName('*'), zIndexMax = 0; for ( var i = 0, etotal = elems.length; i < etotal; i++ ) { - var zindex = document.defaultView.getComputedStyle(elems[i],null).getPropertyValue('z-index'); + var zindex = d.defaultView.getComputedStyle(elems[i],null).getPropertyValue('z-index'); if ( zindex > zIndexMax && zindex !== 'auto' ) { zIndexMax = zindex; }