Skip to content

Commit

Permalink
Formatting fixes per js lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt committed Jul 20, 2011
1 parent 48e401c commit 1fe31b2
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions jquery.reveal.js
Expand Up @@ -7,14 +7,14 @@
*/


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

$.fn.reveal = function(options) {
$.fn.reveal = function (options) {
var defaults = {
animation: 'fadeAndPop', // fade, fadeAndPop, none
animationSpeed: 300, // how fast animtions are
Expand All @@ -23,38 +23,38 @@
};
var options = $.extend({}, defaults, options);

return this.each(function() {
return this.each(function () {
var modal = $(this),
topMeasure = parseInt(modal.css('top')),
topOffset = modal.height() + topMeasure,
locked = false,
modalBg = $('.reveal-modal-bg');

if(modalBg.length == 0) {
if (modalBg.length == 0) {
modalBg = $('<div class="reveal-modal-bg" />').insertAfter(modal);
}

function openAnimation() {
modalBg.unbind('click.modalEvent');
$('.' + options.dismissModalClass).unbind('click.modalEvent');
if(!locked) {
if (!locked) {
lockModal();
if(options.animation == "fadeAndPop") {
if (options.animation == "fadeAndPop") {
modal.css({'top': $(document).scrollTop() - topOffset, 'opacity': 0, 'visibility': 'visible'});
modalBg.fadeIn(options.animationSpeed/2);
modal.delay(options.animationSpeed/2).animate({
modalBg.fadeIn(options.animationSpeed / 2);
modal.delay(options.animationSpeed / 2).animate({
"top": $(document).scrollTop() + topMeasure + 'px',
"opacity": 1
}, options.animationSpeed,unlockModal());
}, options.animationSpeed, unlockModal());
}
if(options.animation == "fade") {
if (options.animation == "fade") {
modal.css({'opacity': 0, 'visibility': 'visible', 'top': $(document).scrollTop() + topMeasure});
modalBg.fadeIn(options.animationSpeed/2);
modal.delay(options.animationSpeed/2).animate({
modalBg.fadeIn(options.animationSpeed / 2);
modal.delay(options.animationSpeed / 2).animate({
"opacity": 1
}, options.animationSpeed,unlockModal());
}, options.animationSpeed, unlockModal());
}
if(options.animation == "none") {
if (options.animation == "none") {
modal.css({'visibility': 'visible', 'top': $(document).scrollTop() + topMeasure});
modalBg.css({"display": "block"});
unlockModal()
Expand All @@ -65,28 +65,28 @@
modal.bind('reveal:open', openAnimation);

function closeAnimation() {
if(!locked) {
if (!locked) {
lockModal();
if(options.animation == "fadeAndPop") {
if (options.animation == "fadeAndPop") {
modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed);
modal.animate({
"top": $(document).scrollTop() - topOffset + 'px',
"opacity": 0
}, options.animationSpeed/2, function() {
}, options.animationSpeed / 2, function () {
modal.css({'top': topMeasure, 'opacity': 1, 'visibility': 'hidden'});
unlockModal();
});
}
if(options.animation == "fade") {
if (options.animation == "fade") {
modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed);
modal.animate({
"opacity" : 0
}, options.animationSpeed, function() {
}, options.animationSpeed, function () {
modal.css({'opacity': 1, 'visibility': 'hidden', 'top': topMeasure});
unlockModal();
});
}
if(options.animation == "none") {
if (options.animation == "none") {
modal.css({'visibility': 'hidden', 'top': topMeasure});
modalBg.css({'display': 'none'});
}
Expand All @@ -100,15 +100,15 @@
modal.trigger('reveal:close');
});

if(options.closeOnBackgroundClick) {
if (options.closeOnBackgroundClick) {
modalBg.css({"cursor": "pointer"})
modalBg.bind('click.modalEvent', function() {
modalBg.bind('click.modalEvent', function () {
modal.trigger('reveal:close');
});
}

$('body').keyup(function(event) {
if(event.which === 27) { // 27 is the keycode for the Escape key
$('body').keyup(function (event) {
if (event.which === 27) { // 27 is the keycode for the Escape key
modal.trigger('reveal:close');
}
});
Expand Down

0 comments on commit 1fe31b2

Please sign in to comment.