Skip to content

Commit

Permalink
Removed extra comments that make the code harder to read.
Browse files Browse the repository at this point in the history
  • Loading branch information
coop committed Jul 19, 2011
1 parent 60bee41 commit c2c1101
Showing 1 changed file with 6 additions and 41 deletions.
47 changes: 6 additions & 41 deletions jquery.reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,33 @@


(function($) {

/*---------------------------
Defaults for Reveal
----------------------------*/

/*---------------------------
Listener for data-reveal-id attributes
----------------------------*/

$('a[data-reveal-id]').live('click', function(e) {
e.preventDefault();
var modalLocation = $(this).attr('data-reveal-id');
$('#'+modalLocation).reveal($(this).data());
});

/*---------------------------
Extend and Execute
----------------------------*/

$.fn.reveal = function(options) {
var defaults = {
animation: 'fadeAndPop', //fade, fadeAndPop, none
animationspeed: 300, //how fast animtions are
closeonbackgroundclick: true, //if you click background will modal close?
dismissmodalclass: 'close-reveal-modal' //the class of a button or element that will close an open modal
animation: 'fadeAndPop', // fade, fadeAndPop, none
animationspeed: 300, // how fast animtions are
closeonbackgroundclick: true, // if you click background will modal close?
dismissmodalclass: 'close-reveal-modal' // the class of a button or element that will close an open modal
};

//Extend dem' options
var options = $.extend({}, defaults, options);

return this.each(function() {

/*---------------------------
Global Variables
----------------------------*/
var modal = $(this),
topMeasure = parseInt(modal.css('top')),
topOffset = modal.height() + topMeasure,
locked = false,
modalBG = $('.reveal-modal-bg');

/*---------------------------
Create Modal BG
----------------------------*/
if(modalBG.length == 0) {
modalBG = $('<div class="reveal-modal-bg" />').insertAfter(modal);
}

/*---------------------------
Open & Close Animations
----------------------------*/
//Entrance Animations
function openAnimation() {
modalBG.unbind('click.modalEvent');
$('.' + options.dismissmodalclass).unbind('click.modalEvent');
Expand Down Expand Up @@ -90,7 +65,6 @@
}
modal.bind('reveal:open', openAnimation);

//Closing Animation
function closeAnimation() {
if(!locked) {
lockModal();
Expand Down Expand Up @@ -121,14 +95,8 @@
modal.unbind('reveal:close', closeAnimation);
}
modal.bind('reveal:close', closeAnimation);

/*---------------------------
Open and add Closing Listeners
----------------------------*/
//Open Modal Immediately
modal.trigger('reveal:open')

//Close Modal Listeners
var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
modal.trigger('reveal:close')
});
Expand All @@ -146,9 +114,6 @@
}
});

/*---------------------------
Animations Locks
----------------------------*/
function unlockModal() {
locked = false;
}
Expand All @@ -157,6 +122,6 @@
locked = true;
}

});//each call
}//orbit plugin call
});
}
})(jQuery);

0 comments on commit c2c1101

Please sign in to comment.