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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
<!DOCTYPE html> <html lang="en"> <head> <title>BENJABHORN GROUP เบญจพร กรุ๊ป</title> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="keywords" content="Benjabhorn Group, B.J., precast, Land and House, แลนด์ แอนด์ เฮ้าส์, บ้าน, บ้านเดี่ยว, ทาวน์โฮม, คอนโด, บ้านจัดสรร, โครงการจัดสรร, บ้านพร้อมอยู่, ที่อยู่อาศัย"> <meta name="description" content="เบญจพร แลนด์ แอนด์ เฮ้าส์ บ้านที่ไม่เอาเปรียบผู้บริโภค"> <meta name="author" content="Codrops" /> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" type="text/css" href="css/demo.css" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link href='http://fonts.googleapis.com/css?family=Miltonian|Bitter' rel='stylesheet' type='text/css' /> <script type="text/javascript" src="js/modernizr.custom.21750.js"></script> <noscript> <style> .bx-loading{display:none;} </style> </noscript> </head> <body> <div class="container"> <div class="header"> <a href="http://www.bj.co.th/benjabhorn_group/index.php" target="_blank"><strong>≡ Benjabhorn Land & House</strong></a><a href="http://www.bj.co.th/BJ_precast/index.php" target="_blank"><strong>≡ B.J. PRECAST CO.,LTD.</strong></a><a href="http://www.bj.co.th/BJ_concrete/index.html" target="_blank"><strong>≡ Benjabhorn Concrete Products</strong></a><a href="#"><strong>≡ Benjabhorn Market</strong></a> <span class="right"> <strong>Call 6674 335121 - 2 </strong> </span> <div class="clr"></div> </div> <div id="bx-wrapper" class="bx-wrapper"> <div class="bx-loading"> <span>Loading...</span> </div> <div class="bx-content"> <h3></h3> </div> <div class="bx-thumbs"> <a href="benjabhorn_group/index.php" style="background-image:url(images/thumbs/1.jpg)" target="_blank"></a> <a href="BJ_precast/index.php" style="background-image:url(images/thumbs/2.jpg)" target="_blank"></a> <a href="BJ_concrete/index.php" style="background-image:url(images/thumbs/3.jpg)" target="_blank"></a> <a href="#" style="background-image:url(images/thumbs/4.jpg)" target="_blank"></a> </div> <!-- <div class="bx-content"> <h1><a href="index.html">B.J. PRECAST CO.,LTD.</a> <a href="index.html">Benjabhorn Land & House</a> <a href="index.html">test</a> <a href="index.html">test</a></h1> </div> --> <div class="bx-container"> <img src="images/large/1.jpg" alt="image04" title=""/> <img src="images/large/2.jpg" alt="image03" title=""/> <img src="images/large/3.jpg" alt="image02" title=""/> <img src="images/large/4.jpg" alt="image01" title=""/> </div> <div class="bx-overlay"></div> </div> </div> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> <script type="text/javascript" src="js/StackBlur.js"></script> <script type="text/javascript"> $(function() { var BlurBGImage = (function() { var $bxWrapper = $('#bx-wrapper'), // loading status to show while preloading images $bxLoading = $bxWrapper.find('div.bx-loading'), // container for the bg images and respective canvas $bxContainer = $bxWrapper.find('div.bx-container'), // the bg images we are gonna use $bxImgs = $bxContainer.children('img'), // total number of bg images bxImgsCount = $bxImgs.length, // current image's index current = 0, // variation to show the image: // (1) - blurs the current one, fades out and shows the next image // (2) - blurs the current one, fades out, shows the next one (but initially blurred) // speed is the speed of the animation // blur Factor is the factor used in the StackBlur script animOptions = { speed : 700, variation : 2, blurFactor : 1 }, // control if currently animating isAnim = false, // check if canvas is supported supportCanvas = Modernizr.canvas, // slideshow slideshow_interval = 6000, slideshow_time, // init function init = function() { // preload all images and respective canvas var loaded = 0; $bxImgs.each( function(i) { var $bximg = $(this); // save the position of the image in data-pos $('<img data-pos="' + $bximg.index() + '"/>').load(function() { var $img = $(this), // size of image to be fullscreen and centered dim = getImageDim( $img.attr('src') ), pos = $img.data( 'pos' ); // add the canvas to the DOM $.when( createCanvas( pos, dim ) ).done( function() { ++loaded; // all images and canvas loaded if( loaded === bxImgsCount ) { // apply style for bg image and canvas centerImageCanvas(); // hide loading status $bxLoading.hide(); // initialize events initEvents(); // start slideshow startSlideshow(); } }); }).attr( 'src', $bximg.attr('src') ); }); }, startSlideshow = function() { slideshow_time = setTimeout( function() { if( !isAnim ) { var pos = current; ( pos < bxImgsCount - 1 ) ? ++pos : pos = 0; isAnim = true; // show the bg image showImage( pos ); startSlideshow(); } }, slideshow_interval ); }, // creates the blurred canvas image createCanvas = function( pos, dim ) { return $.Deferred( function(dfd) { // if canvas not supported return if( !supportCanvas ) { dfd.resolve(); return false; } // create the canvas element: // size and position will be the same like the fullscreen image var $img = $bxImgs.eq( pos ), imgW = dim.width, imgH = dim.height, imgL = dim.left, imgT = dim.top, canvas = document.createElement('canvas'); canvas.className = 'bx-canvas'; canvas.width = imgW; canvas.height = imgH; canvas.style.width = imgW + 'px'; canvas.style.height = imgH + 'px'; canvas.style.left = imgL + 'px'; canvas.style.top = imgT + 'px'; canvas.style.visibility = 'hidden'; // save position of canvas to know which image this is linked to canvas.setAttribute('data-pos', pos); // append the canvas to the same container where the images are $bxContainer.append( canvas ); // blur it using the StackBlur script stackBlurImage( $img.get(0), dim, canvas, animOptions.blurFactor, false, dfd.resolve ); }).promise(); }, // gets the image size and position in order to make it fullscreen and centered. getImageDim = function( img ) { var $img = new Image(); $img.src = img; var $win = $( window ), w_w = $win.width(), w_h = $win.height(), r_w = w_h / w_w, i_w = $img.width, i_h = $img.height, r_i = i_h / i_w, new_w, new_h, new_left, new_top; if( r_w > r_i ) { new_h = w_h; new_w = w_h / r_i; } else { new_h = w_w * r_i; new_w = w_w; } return { width : new_w, height : new_h, left : ( w_w - new_w ) / 2, top : ( w_h - new_h ) / 2 }; }, // initialize the events initEvents = function() { $( window ).on('resize.BlurBGImage', function( event ) { // apply style for bg image and canvas centerImageCanvas(); return false; }); }, // apply style for bg image and canvas centerImageCanvas = function() { $bxImgs.each( function(i) { var $bximg = $(this), dim = getImageDim( $bximg.attr('src') ), $currCanvas = $bxContainer.children('canvas[data-pos=' + $bximg.index() + ']'), styleCSS = { width : dim.width, height : dim.height, left : dim.left, top : dim.top }; $bximg.css( styleCSS ); if( supportCanvas ) $currCanvas.css( styleCSS ); if( i === current ) $bximg.show(); }); }, // shows the image at position "pos" showImage = function( pos ) { // current image var $bxImage = $bxImgs.eq( current ); // current canvas $bxCanvas = $bxContainer.children('canvas[data-pos=' + $bxImage.index() + ']'), // next image to show $bxNextImage = $bxImgs.eq( pos ), // next canvas to show $bxNextCanvas = $bxContainer.children('canvas[data-pos='+$bxNextImage.index()+']'); // if canvas is supported if( supportCanvas ) { $bxCanvas.css( 'z-index', 100 ).css('visibility','visible'); $.when( $bxImage.fadeOut( animOptions.speed ) ).done( function() { switch( animOptions.variation ) { case 1 : $.when( $bxNextImage.fadeIn( animOptions.speed ) ).done( function() { $bxCanvas.css( 'z-index', 1 ).css('visibility','hidden'); current = pos; $bxNextCanvas.css('visibility','hidden'); isAnim = false; }); break; case 2 : $bxNextCanvas.css('visibility','visible'); $.when( $bxCanvas.fadeOut( animOptions.speed * 1.5 ) ).done( function() { $(this).css({ 'z-index' : 1, 'visibility' : 'hidden' }).show(); $.when( $bxNextImage.fadeIn( animOptions.speed ) ).done( function() { current = pos; $bxNextCanvas.css('visibility','hidden'); isAnim = false; }); }); break; }; }); } // if canvas is not shown just work with the bg images else { $.when( $bxNextImage.css( 'z-index', 102 ).fadeIn( animOptions.speed ) ).done( function() { current = pos; $bxImage.hide(); $(this).css( 'z-index', 101 ); isAnim = false; }); } }; return { init : init }; })(); // call the init function BlurBGImage.init(); }); </script> </body> </html>
|