Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
<h1>Velocity.js animation effects with Magnific Popup</h1>
  <h4>Select Animation:</h4>
<b>Popup Opening Animation</b>
  <select id="open" class="select-style">
    <option value="transition.fadeIn">fadeIn</option>
    <option value="transition.flipXIn">flipXIn</option>
    <option value="transition.flipYIn">flipYIn</option>
    <option value="transition.flipBounceXIn">flipBounceXIn</option>
    <option value="transition.flipBounceYIn">flipBounceYIn</option>
    <option value="transition.swoopIn" selected >swoopIn</option>
    <option value="transition.whirlIn">whirlIn</option>
    <option value="transition.shrinkIn">shrinkIn</option>
    <option value="transition.expandIn">expandIn</option>
    <option value="transition.bounceIn">bounceIn</option>
    <option value="transition.bounceUpIn">bounceUpIn</option>
    <option value="transition.bounceDownIn">bounceDownIn</option>
    <option value="transition.bounceLeftIn">bounceLeftIn</option>
    <option value="transition.bounceRightIn">bounceRightIn</option>
    <option value="transition.slideUpIn">slideUpIn</option>
    <option value="transition.slideDownIn">slideDownIn</option>
    <option value="transition.slideLeftIn">slideLeftIn</option>
    <option value="transition.slideRightIn">slideRightIn</option>
    <option value="transition.slideUpBigIn">slideUpBigIn</option>
    <option value="transition.slideDownBigIn">slideDownBigIn</option>
    <option value="transition.slideLeftBigIn">slideLeftBigIn</option>
    <option value="transition.slideRightBigIn">slideRightBigIn</option>
    <option value="transition.perspectiveUpIn">perspectiveUpIn</option>
    <option value="transition.perspectiveDownIn">perspectiveDownIn</option>
    <option value="transition.perspectiveLeftIn">perspectiveLeftIn</option>
    <option value="transition.perspectiveRightIn">perspectiveRightIn</option>
  </select>
  <br><b>Previous-Next Animation</b>
  <select id="Effect" class="select-style">
    <option value="callout.bounce">bounce</option>
    <option value="callout.shake">shake</option>
    <option value="callout.flash">flash</option>
    <option value="callout.pulse">pulse</option>
    <option value="callout.swing">swing</option>
    <option value="callout.tada">tada</option>
    <option value="transition.fadeIn"fadeIn</option>
    <option value="transition.flipXIn">flipXIn</option>
    <option value="transition.flipYIn">flipYIn</option>
    <option value="transition.flipBounceXIn">flipBounceXIn</option>
    <option value="transition.flipBounceYIn">flipBounceYIn</option>
    <option value="transition.swoopIn" >swoopIn</option>
    <option value="transition.whirlIn">whirlIn</option>
    <option value="transition.shrinkIn">shrinkIn</option>
    <option value="transition.expandIn" selected>expandIn</option>
    <option value="transition.bounceIn">bounceIn</option>
    <option value="transition.bounceUpIn">bounceUpIn</option>
    <option value="transition.bounceDownIn">bounceDownIn</option>
    <option value="transition.bounceLeftIn">bounceLeftIn</option>
    <option value="transition.bounceRightIn">bounceRightIn</option>
    <option value="transition.slideUpIn">slideUpIn</option>
    <option value="transition.slideDownIn">slideDownIn</option>
    <option value="transition.slideLeftIn">slideLeftIn</option>
    <option value="transition.slideRightIn">slideRightIn</option>
    <option value="transition.slideUpBigIn">slideUpBigIn</option>
    <option value="transition.slideDownBigIn">slideDownBigIn</option>
    <option value="transition.slideLeftBigIn">slideLeftBigIn</option>
    <option value="transition.slideRightBigIn">slideRightBigIn</option>
    <option value="transition.perspectiveUpIn">perspectiveUpIn</option>
    <option value="transition.perspectiveDownIn">perspectiveDownIn</option>
    <option value="transition.perspectiveLeftIn">perspectiveLeftIn</option>
    <option value="transition.perspectiveRightIn">perspectiveRightIn</option>
</select>
  <h4>Click Images to Open Lightbox, Arrows to Advance</h4>
 
</div>

  
<div class="popup-gallery">
        <a class="pop" href="http://farm9.staticflickr.com/8242/8558295633_f34a55c1c6_b.jpg" title="The Cleaner"><img src="http://farm9.staticflickr.com/8242/8558295633_f34a55c1c6_q.jpg" width="120" height="120"></a>
        <a class="pop" href="http://farm9.staticflickr.com/8382/8558295631_0f56c1284f_b.jpg" title="Winter Dance"><img src="http://farm9.staticflickr.com/8382/8558295631_0f56c1284f_q.jpg" width="120" height="120"></a>
        <a class="pop" href="http://farm9.staticflickr.com/8225/8558295635_b1c5ce2794_b.jpg" title="The Uninvited Guest"><img src="http://farm9.staticflickr.com/8225/8558295635_b1c5ce2794_q.jpg" width="120" height="120"></a>
        <a class="pop" href="http://farm9.staticflickr.com/8383/8563475581_df05e9906d_b.jpg" title="Oh no, not again!"><img src="http://farm9.staticflickr.com/8383/8563475581_df05e9906d_q.jpg" width="120" height="120"></a>
        <a class="pop" href="http://farm9.staticflickr.com/8235/8559402846_8b7f82e05d_b.jpg" title="Swan Lake"><img src="http://farm9.staticflickr.com/8235/8559402846_8b7f82e05d_s.jpg" width="120" height="120"></a>
        <a class="pop" href="http://farm9.staticflickr.com/8235/8558295467_e89e95e05a_b.jpg" title="The Shake"><img src="http://farm9.staticflickr.com/8235/8558295467_e89e95e05a_s.jpg" width="120" height="120"></a>
        <a class="pop" href="http://farm9.staticflickr.com/8378/8559402848_9fcd90d20b_b.jpg" title="Who's that, mommy?"><img src="http://farm9.staticflickr.com/8378/8559402848_9fcd90d20b_q.jpg" width="120" height="120"></a>
  <a class="pop" href="http://farm9.staticflickr.com/8241/8589392310_7b6127e243_b.jpg" title="Who's that, mommy?"><img src="http://farm9.staticflickr.com/8241/8589392310_7b6127e243_q.jpg" width="120" height="120"></a>
      </div>
</div>
<div class="info"><a href="http://dimsemenov.com/plugins/magnific-popup/" title="Magnific-Popup">Magnific-Popup</a><p>
<a href="http://julian.com/research/velocity/" title="Velocity.js">Velocity.js</a></div>





              
            
!

CSS

              
                @import "compass/css3";

html,body {margin:0; padding:10px; -webkit-backface-visibility:hidden;font-size: 16px;}
.container{width:960px;margin: 0 auto 0;text-align:center;}
/* preview styles */
.popup-gallery{margin:20px auto 0; width:600px;}
html {
  font-family: "Calibri", "Trebuchet MS", "Helvetica", sans-serif;
}
h1 {
  margin: 5px;
  font-size: 30px;
}
h4{font-size: 22px;margin: 5px;}
a.pop{padding:8px; float:left;}
select{margin:15px; font-size:15px;}

@media all and (min-width: 480px) {
  .mfp-arrow {
    -webkit-transform: scale(1.6);
    transform: scale(1.6); }
}
.select-style {
    border: 1px solid #ccc;
    width: 130px;
    border-radius: 3px;
    overflow: hidden;
    background: #fafafa;
}

.select-style select {
    padding: 5px 8px;
    width: 160px;
    border: none;
    box-shadow: none;
    background: transparent;
    background-image: none;
    -webkit-appearance: none;
}

.select-style select:focus {
    outline: none;
}
.info{position:fixed; top:10px; left:10px;}
              
            
!

JS

              
                //Image Hover
$('a.pop img').velocity({borderRadius: 4}).velocity({boxShadowBlur:5});
$('a.pop img').mouseenter(function () {
       $(this).addClass('hover'); 
      $('.hover').velocity({scale:1.1},{
            duration: 200
        });
     }).mouseleave(function () {   
      $('.hover').velocity('reverse'); 
      $(this).removeClass('hover');
    });
  

// Image popups
$('.pop').magnificPopup({
    mainClass: 'mfp-velocity',
    type: 'image',
   closeBtnInside : true,
    gallery: {
        enabled: true
    },
    removalDelay: 500, //delay removal by X to allow out-animation
    callbacks: {
        open: function () {
            var open = $("#open").val();
            this.content.velocity(open);
            $.magnificPopup.instance.next = function () {
                var self = this;               
                setTimeout(function () {
                    $.magnificPopup.proto.next.call(self);
                }, 100);  
                var effectNext = $("#Effect").val();
                var animateOptions = {
                    delay: 200,
                    duration: !/\./.test(effectNext) ? 500 : null
                };
                if (effectNext === "fadeIn" || /In$/.test(effectNext)) {
                    this.content.velocity({
                        opacity: 0
                    }, 100);
                }
         
                this.content.velocity(effectNext, animateOptions);

            };
            $.magnificPopup.instance.prev = function () {
                var self = this;
                setTimeout(function () {
                    $.magnificPopup.proto.prev.call(self);
                }, 50);
               
                var effectPrev = $("#Effect").val();              
                var animateOptions = {
                    delay: 200,
                    duration: !/\./.test(effectPrev) ? 500 : null
                };
                if (effectPrev === "fadeIn" || /In$/.test(effectPrev)) {
                    this.content.velocity({
                        opacity: 0
                    }, 100);
                }
              
              
      
                this.content.velocity(effectPrev, animateOptions);

            };
        },
        beforeClose: function () {
            var open = $("#open").val();
         var close = open.replace('In', 'Out');  
            this.content.velocity(close, {
                duration: 500
            });
        },
        closeOnContentClick: true,
    midClick: true 
    }});
              
            
!
999px

Console