-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjotaese.js
More file actions
155 lines (127 loc) · 4.54 KB
/
jotaese.js
File metadata and controls
155 lines (127 loc) · 4.54 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
(function($){
$.smartBackgroundResize = function(el, options, options){
var base = this;
var isIE = false;
isIE = false;//$.browser.msie;
base.$el = $(el);
base.el = el;
base.$el.data(el, base); // Add a reverse reference to the DOM object
var images,imagePath, imageActual,preloadActual,picWidth,picHeight, isVideo;
base.init = function(){
base.options = $.extend({},$.smartBackgroundResize.defaultOptions, options);
base.$el.css("display", "none");
base.$el.css("line-height","0px");
base.$el.css("position","fixed");
base.$el.css("z-index","-100");
base.$el.css("overflow","hidden");
base.$el.css("margin","0px");
base.$el.css("padding","0px");
base.image = base.options.image;
base.$el.html('<img id="main_image" style="position:absolute;" src="'+base.getImageSourceActual()+'">"');
base.mainimage = $('#main_image');
base.loadFirstimage();
$(window).bind('resize', function() {base.resizeImage(); });
};
base.resizeImage = function() {
var navWidth = $(window).width();
var navHeight = $(window).height();
var navRatio = navWidth / navHeight;
if (base.mainimage.width() > 1) picWidth = base.mainimage.width();
if (base.mainimage.height() > 1) picHeight = base.mainimage.height();
picRatio = picWidth / picHeight;
if (navRatio > picRatio) {
var newHeight = (navWidth / picWidth) * picHeight;
var newWidth = navWidth;
} else {
var newHeight = navHeight;
var newWidth = (navHeight / picHeight) * picWidth;
}
newTop = 0 - ((newHeight - navHeight) / 2);
newLeft = 0 - ((newWidth - navWidth) / 2);
base.$el.css({height: navHeight, width: navWidth});
base.$el.css({visibility:"visible", display:"block"});
base.mainimage.css({height: newHeight, width: newWidth});
base.mainimage.css("top",newTop+"px");
base.mainimage.css("left",newLeft+"px");
};
base.preloadImage = function(source, nextEvent) {
$('<img />').attr('src', source).load(nextEvent);
};
base.loadFirstimage = function() {
var imageSource = base.getImageSourceActual();
base.preloadImage(imageSource, base.loadFirstimageEnd);
};
base.loadFirstimageEnd=function () {
var imageSource = base.getImageSourceActual();
base.mainimage.attr("src",imageSource);
base.$el.fadeIn(1000);
base.resizeImage();
};
base.getImageSourceActual=function (){
var idImage = base.image;
var imageSource = base.options.imagePath+idImage;
return imageSource;
};
base.init();
};
$.smartBackgroundResize.defaultOptions = {
imagePath: "",
imageActual: 0,
preloadActual: 0
};
$.fn.smartBackgroundResize = function(options){
$('body').css("margin","0px");
$('body').css("padding","0px");
return this.each(function(){
(new $.smartBackgroundResize(this, options, options));
});
};
})(jQuery);
$(document).ready(function(){
$("#botonocultamuestra").click(function(){
$("#divocultamuestra").each(function() {
displaying = $(this).css("display");
if(displaying == "block") {
$(this).fadeOut('slow',function() {
$(this).css("display","none");
});
} else {
$(this).fadeIn('slow',function() {
$(this).css("display","block");
});
}
});
});
});
$(document).ready(function(){
$("#botonocultamuestra1").click(function(){
$("#divocultamuestra1").each(function() {
displaying = $(this).css("display");
if(displaying == "block") {
$(this).fadeOut('slow',function() {
$(this).css("display","none");
});
} else {
$(this).fadeIn('slow',function() {
$(this).css("display","block");
});
}
});
});
});
$(document).ready(function(){
$("#botonocultamuestra2").click(function(){
$("#divocultamuestra2").each(function() {
displaying = $(this).css("display");
if(displaying == "block") {
$(this).fadeOut('slow',function() {
$(this).css("display","none");
});
} else {
$(this).fadeIn('slow',function() {
$(this).css("display","block");
});
}
});
});
});