diff --git a/README.md b/README.md index 7d8c936..a7a59a8 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,13 @@ jQuery Modal Window Effects with transitions CSS3. See the [project page](http:/ ## Changelog: +### Version 1.1.0 - 2013/10/22 +* Added new property of the position to the output. +* Added support responsive. +* Added property hide scrollbar automatically. +* Cleaning stylesheets for the modern browsers. +* Bug fixes. + ### Version 1.0.2 - 2013/10/08 * Bug fix on callback that fires once is closed. @@ -13,4 +20,4 @@ jQuery Modal Window Effects with transitions CSS3. See the [project page](http:/ * First release. ### Version 0.1b - 2013/09/06 -* First beta release. +* First beta release. \ No newline at end of file diff --git a/custombox.jquery.json b/custombox.jquery.json index ddbd26c..92812ca 100644 --- a/custombox.jquery.json +++ b/custombox.jquery.json @@ -14,9 +14,10 @@ "transitions", "dialog", "ajax", - "jquery" + "jquery", + "responsive" ], - "version": "1.0.2", + "version": "1.1.0", "author": { "name": "Julio De La Calle", "email": "juliodlcp@gmail.com", diff --git a/demo/css/demo.css b/demo/css/demo.css index 4ff28c2..3a9d97a 100755 --- a/demo/css/demo.css +++ b/demo/css/demo.css @@ -123,15 +123,6 @@ h3 em { border-radius: 6px; outline: 0 none; } -@media only screen and (max-device-width: 480px) { - .modal-example-content { - width: 300px; - } - .modal-example-body p { - height: 200px; - overflow: hidden; - } -} .modal-example-header { border-bottom: 1px solid #E5E5E5; padding: 15px; @@ -178,4 +169,32 @@ h3 em { } .justme .modal-example-header { border: none; +} + + +/* + ---------------------------- + Modal Example 4 + ---------------------------- + */ +#modal3 { + margin-top: 70px; +} + + +/* + ---------------------------- + Custom animation + ---------------------------- + */ +.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/demo/js/demo.js b/demo/js/demo.js index 7e1ebb5..bda9e92 100755 --- a/demo/js/demo.js +++ b/demo/js/demo.js @@ -58,11 +58,11 @@ $(function() { Fadein ---------------------------- */ - $('#fadein').on('click', function () { + $('#fadein').on('click', function ( e ) { $.fn.custombox( this, { effect: 'fadein' }); - return false; + e.preventDefault(); }); /* @@ -70,14 +70,14 @@ $(function() { Slide ---------------------------- */ - var slide_position = ['top','right','bottom','center']; + var slide_position = ['top','right','bottom','center','left']; - $('#slide').on('click', function () { + $('#slide').on('click', function ( e ) { $.fn.custombox( this, { effect: 'slide', position: slide_position[Math.floor( Math.random() * slide_position.length )] }); - return false; + e.preventDefault(); }); /* @@ -85,11 +85,11 @@ $(function() { Newspaper ---------------------------- */ - $('#newspaper').on('click', function () { + $('#newspaper').on('click', function ( e ) { $.fn.custombox( this, { effect: 'newspaper' }); - return false; + e.preventDefault(); }); /* @@ -97,11 +97,11 @@ $(function() { Fall ---------------------------- */ - $('#fall').on('click', function () { + $('#fall').on('click', function ( e ) { $.fn.custombox( this, { effect: 'fall' }); - return false; + e.preventDefault(); }); /* @@ -109,11 +109,11 @@ $(function() { Sidefall ---------------------------- */ - $('#sidefall').on('click', function () { + $('#sidefall').on('click', function ( e ) { $.fn.custombox( this, { effect: 'sidefall' }); - return false; + e.preventDefault(); }); /* @@ -123,12 +123,12 @@ $(function() { */ var flip_position = ['vertical','horizontal']; - $('#flip').on('click', function () { + $('#flip').on('click', function ( e ) { $.fn.custombox( this, { effect: 'flip', position: flip_position[Math.floor((Math.random()*2))] }); - return false; + e.preventDefault(); }); /* @@ -136,11 +136,11 @@ $(function() { Sign ---------------------------- */ - $('#sign').on('click', function () { + $('#sign').on('click', function ( e ) { $.fn.custombox( this, { effect: 'sign' }); - return false; + e.preventDefault(); }); /* @@ -148,11 +148,11 @@ $(function() { Sign ---------------------------- */ - $('#superscaled').on('click', function () { + $('#superscaled').on('click', function ( e ) { $.fn.custombox( this, { effect: 'superscaled' }); - return false; + e.preventDefault(); }); /* @@ -160,11 +160,11 @@ $(function() { Slit ---------------------------- */ - $('#slit').on('click', function () { + $('#slit').on('click', function ( e ) { $.fn.custombox( this, { effect: 'slit' }); - return false; + e.preventDefault(); }); /* @@ -174,12 +174,12 @@ $(function() { */ var rotate_position = ['bottom','left']; - $('#rotate').on('click', function () { + $('#rotate').on('click', function ( e ) { $.fn.custombox( this, { effect: 'rotate', position: rotate_position[Math.floor((Math.random()*2))] }); - return false; + e.preventDefault(); }); /* @@ -187,7 +187,7 @@ $(function() { Letmein ---------------------------- */ - $('#letmein').on('click', function () { + $('#letmein').on('click', function ( e ) { $.fn.custombox( this, { effect: 'letmein', // Remove style attribute. @@ -195,7 +195,7 @@ $(function() { $('#sidebar').removeAttr('style'); } }); - return false; + e.preventDefault(); }); /* @@ -203,7 +203,7 @@ $(function() { Makeway ---------------------------- */ - $('#makeway').on('click', function () { + $('#makeway').on('click', function ( e ) { $.fn.custombox( this, { effect: 'makeway', // Remove style attribute. @@ -211,7 +211,7 @@ $(function() { $('#sidebar').removeAttr('style'); } }); - return false; + e.preventDefault(); }); /* @@ -219,7 +219,7 @@ $(function() { Slip ---------------------------- */ - $('#slip').on('click', function () { + $('#slip').on('click', function ( e ) { $.fn.custombox( this, { effect: 'slip', // Remove style attribute. @@ -227,7 +227,7 @@ $(function() { $('#sidebar').removeAttr('style'); } }); - return false; + e.preventDefault(); }); /* @@ -235,23 +235,23 @@ $(function() { Blur ---------------------------- */ - $('#blur').on('click', function () { + $('#blur').on('click', function ( e ) { $.fn.custombox( this, { effect: 'blur' }); - return false; + e.preventDefault(); }); /* ---------------------------- Custom - Without overlay ---------------------------- */ - $('#example1').on('click', function () { + $('#example1').on('click', function ( e ) { $.fn.custombox( this, { overlay: false, effect: 'fadein' }); - return false; + e.preventDefault(); }); /* @@ -259,11 +259,11 @@ $(function() { Custom - Ajax ---------------------------- */ - $('#example2').on('click', function () { + $('#example2').on('click', function ( e ) { $.fn.custombox( this, { effect: 'newspaper' }); - return false; + e.preventDefault(); }); /* @@ -271,7 +271,7 @@ $(function() { Custom - Auto start ---------------------------- */ - $('#example3').on('click', function () { + $('#example3').on('click', function ( e ) { var clock = 5, countdownId = 0, eCountdown = document.getElementById('countdown'); @@ -294,7 +294,7 @@ $(function() { clearInterval(countdown); } }, 1000); - return false; + e.preventDefault(); }); /* @@ -302,12 +302,12 @@ $(function() { Custom - Error :( ---------------------------- */ - $('#example4').on('click', function () { + $('#example4').on('click', function ( e ) { $.fn.custombox( this, { effect: 'slit', error: 'OPS! File not found' }); - return false; + e.preventDefault(); }); /* @@ -315,7 +315,7 @@ $(function() { Custom - Callbacks ---------------------------- */ - $('#example5').on('click', function () { + $('#example5').on('click', function ( e ) { $.fn.custombox( this, { open: function () { alert('open'); @@ -327,7 +327,7 @@ $(function() { alert('close'); } }); - return false; + e.preventDefault(); }); /* @@ -335,25 +335,53 @@ $(function() { Custom - Other style ---------------------------- */ - $('#example6').on('click', function () { + $('#example6').on('click', function ( e ) { $.fn.custombox( this ); - return false; + e.preventDefault(); }); /* ---------------------------- - Custom effect + Custom effect 1 ---------------------------- */ - $('#example7').on('click', function () { + $('#example7').on('click', function ( e ) { $.fn.custombox( this, { - effect: 'fadein', - overlayColor: '#FFF', + effect: 'fadein', + overlayColor: '#FFF', overlayOpacity: 1, - customClass: 'justme', - speed: 200 + customClass: 'justme', + speed: 200 }); - return false; + e.preventDefault(); + }); + + /* + ---------------------------- + Custom effect 2 + ---------------------------- + */ + $('#example8').on('click', function ( e ) { + $.fn.custombox( this, { + effect: 'slide', + position: 'center', + customClass: 'customslide', + speed: 200 + }); + e.preventDefault(); + }); + + /* + ---------------------------- + Custom open and close position + ---------------------------- + */ + $('#example9').on('click', function ( e ) { + $.fn.custombox( this, { + effect: 'slide', + position: 'left, right' + }); + e.preventDefault(); }); }); \ No newline at end of file diff --git a/index.html b/index.html index f12a31b..03e8eec 100755 --- a/index.html +++ b/index.html @@ -23,15 +23,18 @@ - + + + + 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! @@ -163,10 +166,11 @@

About Custombox:

Call the plugin when the body is on load:

<script>
 window.onload = function () {
-    document.getElementById('example').addEventListener('click', function () {
+    document.getElementById('example').addEventListener('click', function ( e ) {
         custombox( this, {
             effect: 'fadein'
         });
+        e.preventDefault();
     }, false );
 };
 </script>
@@ -192,9 +196,9 @@

How to use:

4) Call the plugin when the body is on load:

<script>
 $(function () {
-    $('#element').on('click', function () {
+    $('#element').on('click', function ( e ) {
         $.fn.custombox( this );
-        return false;
+        e.preventDefault();
     });
 });
 </script>
@@ -283,7 +287,7 @@

Settings

position null - Only with effects: slide, flip and rotate. (top, right, bottom and left) | (vertical or horizontal). + Only with effects: slide, flip and rotate. (top, right, bottom, left and center) | (vertical or horizontal) and output position sseparated by commas. Ex: 'top, bottom'. speed @@ -306,9 +310,14 @@

Settings

Callback that fires once is closed. - error - Error 404! - Text to be displayed when an error. + responsive + true + Sets if you like box responsive or not. + + + scrollbar + false + Show scrollbar or hide automatically. @@ -327,23 +336,25 @@

Custom

Without overlay

- Example

-
$('#example1').on('click', function () {
+                    
+$('#example1').on('click', function ( e ) {
     $.fn.custombox( this, {
         overlay: false,
         effect: 'fadein'
     });
-    return false;
+    e.preventDefault();
 });

Ajax

- Example

-
$('#example2').on('click', function () {
+                    
+$('#example2').on('click', function ( e ) {
     $.fn.custombox( this, {
         effect: 'newspaper'
     });
-    return false;
+    e.preventDefault();
 });
@@ -358,18 +369,20 @@

Auto start

Error :(

- Example

-
$('#example4').on('click', function () {
+                    
+$('#example4').on('click', function ( e ) {
     $.fn.custombox( this, {
         effect: 'slit'
     });
-    return false;
+    e.preventDefault();
 });

Callbacks

- Example

-
$('#example5').on('click', function () {
+                    
+$('#example5').on('click', function ( e ) {
     $.fn.custombox( this, {
         open: function () {
             alert('open');
@@ -381,37 +394,83 @@ 

Callbacks

alert('close'); } }); - return false; + e.preventDefault(); });

Other style

- Example

-
$('#example6').on('click', function () {
+                    
+$('#example6').on('click', function ( e ) {
     $.fn.custombox( this );
-    return false;
+    e.preventDefault();
 });
 
-
-

Custom effect

+

Custom effect 1

- Example

-
$('#example7').on('click', function () {
+                    
+$('#example7').on('click', function ( e ) {
     $.fn.custombox( this, {
-        effect: 'fadein',
-        overlayColor: '#FFF',
+        effect:         'fadein',
+        overlayColor:   '#FFF',
         overlayOpacity: 1,
-        customClass: 'justme',
-        speed: 200
+        customClass:    'justme',
+        speed:          200
     });
-    return false;
+    e.preventDefault();
 });
 
+
+

Custom effect 2

+

- Example

+
The Javascript:
+
+$('#example8').on('click', function ( e ) {
+    $.fn.custombox( this, {
+        effect:         'slide',
+        position:       'center',
+        customClass:    'customslide',
+        speed:          200
+    });
+    e.preventDefault();
+});
+
+
The CSS (Prefix: custombox-show and custombox-close):
+
+.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;
+}
+
+
+ +
+

Custom open and close position.

+

- Example

+
+$('#example8').on('click', function ( e ) {
+    $.fn.custombox( this, {
+        effect:     'slide',
+        position:   'left, right'
+    });
+    e.preventDefault();
+});
+
+
+

Support:

- Find any bugs? Issues.

@@ -446,9 +505,13 @@

jQuery Custombox

+ + + +