PageSourceSearch

https://fabulous.com/assets/js/jquery.reveal.js

js fabulous.com collected 2026-09-29 17:20:25 UTC 4,546 bytes, 134 lines download raw bytes

1/*
2 * jQuery Reveal Plugin 1.0
3 * www.ZURB.com
4 * Copyright 2010, ZURB
5 * Free to use under the MIT license.
6 * http://www.opensource.org/licenses/mit-license.php
7*/
8
9
10(function ($) {
11
12  $.fn.reveal = function (options) {
13    var defaults = {
14      animation: 'fadeAndPop',                // fade, fadeAndPop, none
15      animationSpeed: 300,                    // how fast animtions are
16      closeOnBackgroundClick: true,           // if you click background will modal close?
17      dismissModalClass: 'close-reveal-modal' // the class of a button or element that will close an open modal
18    };
19    var options = $.extend({}, defaults, options);
20
21    return this.each(function () {
22      var modal    = $(this),
23        topMeasure = parseInt(modal.css('top')),
24        topOffset  = modal.height() + topMeasure,
25        locked     = false,
26        modalBg    = $('.reveal-modal-bg');
27
28      if (modalBg.length == 0) {
29        modalBg = $('<div class="reveal-modal-bg" />').insertAfter(modal);
30        modalBg.fadeTo('fast', 0.8);
31      }
32   
33
34      function openAnimation() {
35        modalBg.unbind('click.modalEvent');
36        $('.' + options.dismissModalClass, modal).unbind('click.modalEvent');
37        if (!locked) {
38          lockModal();
39          if (options.animation == "fadeAndPop") {
40          	
41          	var tof =$(document).scrollTop()-topOffset;
42          
43          	
44            modal.css({'top': tof, 'opacity': 0, 'visibility': 'visible'});
45            modalBg.fadeIn(options.animationSpeed / 2);
46            
47            var tom = $(document).scrollTop() + topMeasure;
48            
49            if(tom <1){
50            	tom=100;       	
51            }
52             
53            modal.delay(options.animationSpeed / 2).animate({
54              "top": tom + 'px',
55              "opacity": 1
56            }, options.animationSpeed, unlockModal);
57          }
58          if (options.animation == "fade") {
59            modal.css({'opacity': 0, 'visibility': 'visible', 'top': $(document).scrollTop() + topMeasure});
60            modalBg.fadeIn(options.animationSpeed / 2);
61            modal.delay(options.animationSpeed / 2).animate({
62              "opacity": 1
63            }, options.animationSpeed, unlockModal);
64          }
65          if (options.animation == "none") {
66            modal.css({'visibility': 'visible', 'top': $(document).scrollTop() + topMeasure});
67            modalBg.css({"display": "block"});
68            unlockModal();
69          }
70        }
71        modal.unbind('reveal:open', openAnimation);
72      }
73      modal.bind('reveal:open', openAnimation);
74
75      function closeAnimation() {
76        if (!locked) {
77          lockModal();
78          if (options.animation == "fadeAndPop") {
79            modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed);
80            modal.animate({
81              "top":  $(document).scrollTop() - topOffset + 'px',
82              "opacity": 0
83            }, options.animationSpeed / 2, function () {
84              modal.css({'top': topMeasure, 'opacity': 1, 'visibility': 'hidden'});
85              unlockModal();
86            });
87          }
88          if (options.animation == "fade") {
89            modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed);
90            modal.animate({
91              "opacity" : 0
92            }, options.animationSpeed, function () {
93              modal.css({'opacity': 1, 'visibility': 'hidden', 'top': topMeasure});
94              unlockModal();
95            });
96          }
97          if (options.animation == "none") {
98            modal.css({'visibility': 'hidden', 'top': topMeasure});
99            modalBg.css({'display': 'none'});
100          }
101        }
102        $("#modal_iframe").remove();
103        modal.unbind('reveal:close', closeAnimation);
104      }
105      modal.bind('reveal:close', closeAnimation);
106      modal.trigger('reveal:open');
107
108      var closeButton = $('.' + options.dismissModalClass, modal).bind('click.modalEvent', function () {
109        modal.trigger('reveal:close');
110      });
111
112      if (options.closeOnBackgroundClick) {
113        modalBg.css({"cursor": "pointer"});
114        modalBg.bind('click.modalEvent', function () {
115          modal.trigger('reveal:close');
116        });
117      }
118
119      $('body').keyup(function (event) {
120        if (event.which === 27) { // 27 is the keycode for the Escape key
121          modal.trigger('reveal:close');
122        }
123      });
124
125      function unlockModal() {
126        locked = false;
127      }
128
129      function lockModal() {
130        locked = true;
131      }
132    });
133  };
134})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.