forked from binary-com/binary-static
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspot_light.js
More file actions
58 lines (48 loc) · 1.7 KB
/
spot_light.js
File metadata and controls
58 lines (48 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var SpotLight = function (){
var that = {};
that.spot_light_box = function () {
var spot_light_box = $('#spot-light-box');
if (!spot_light_box.size())
{
spot_light_box = $('<div id="spot-light-box" class="invisible"></div>').appendTo('body');
}
return spot_light_box;
};
that.cover_page = function () {
var transparent_cover = $('#transparent-cover');
if (!transparent_cover.size())
{
transparent_cover = $('<div id="transparent-cover"></div>').appendTo('body');
}
transparent_cover.removeClass('invisible');
};
that.uncover_page = function () {
$('#transparent-cover').addClass('invisible');
};
that.show = function () {
that.spot_light_box().removeClass('invisible');
that.cover_page();
that.activate_buttons();
};
that.hide = function () {
that.spot_light_box().addClass('invisible');
that.uncover_page();
};
that.set_content = function (content) {
that.spot_light_box().get(0).innerHTML = content;
};
that.attach_click_event = function (selector, event) {
that.spot_light_box().delegate(selector, 'click', event);
};
that.activate_buttons = function() {
$('.close_button').on('click', function (event) {
$(this).parents('.rbox-shadow-popup').toggleClass('invisible');
$('#transparent-cover').toggleClass('invisible');
});
$('.no_button').on('click', function (event) {
$(this).parents('.rbox-shadow-popup').toggleClass('invisible');
$('#transparent-cover').toggleClass('invisible');
});
};
return that;
}();