Changeset 27402 for extensions/Slide/js/slideshow.js
- Timestamp:
- Feb 18, 2014, 8:08:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Slide/js/slideshow.js
r27126 r27402 79 79 $('ul',ele).append($('<li />').addClass('img-' + i).append($('<div />').addClass('contenerImg').width(options.width).height(cont_h).append(blockImg))); 80 80 81 var $block = $('.img-'+ i ,ele);82 _resizeSlideshowImag($block) ;83 84 81 }); 85 82 83 _resizeSlideshowImag(); 86 84 87 //resize and center image_____________________________________________________________________________________________________88 89 function _resizeSlideshowImag ($block){90 91 var $img = $block.find('img'),92 $descr = $block.find('.descr'),93 $img_w = $img.width(),94 $img_h = $img.height(),95 $img_r = $img_h/$img_w,96 $box_h = cont_h,97 $box_w = options.width,98 $box_r = $box_h/$box_w,99 $new_h,100 $new_w;101 102 if(($img_h > $box_h) || ($img_w > $box_w)){103 if($box_r < $img_r){104 $new_h = $box_h - 30;105 $new_w = $box_h / $img_r106 }else{107 $new_h = ($box_w * $img_r) - 30;108 $new_w = $box_w109 };110 111 }else{112 $new_h = $img_h;113 $new_w = $img_w;114 };115 var $left = ($(ele).data('e').s_w / 2)-($new_w / 2) + 'px',116 $top = ($box_h / 2)-($new_h / 2) + 'px';117 118 $img.css({119 width : $new_w + 'px',120 height : $new_h + 'px',121 left : $left,122 top : $top,123 });124 $descr.css(125 {126 left : $left,127 width : $new_w + 'px',128 height : $new_h/4,129 bottom : (($box_h / 2)-($new_h / 2)) + 'px',130 })131 // })132 };133 85 //slide_____________________________________________________________________________________________ 134 86 if(options.styleSlideshow == 'Slide'){ … … 323 275 324 276 //___________________________________________Fonctions_____________________________________________________________________________________ 277 //resize and center image__________________________________________________________________________________________________________________ 278 279 function _resizeSlideshowImag (){ 280 281 $('ul img',ele).each(function(){ 282 var $img = $(this), 283 $descr = $(this).prev(), 284 $img_w = $img.width(), 285 $img_h = $img.height(), 286 $img_r = $img_h/$img_w, 287 $box_h = cont_h, 288 $box_w = options.width, 289 $box_r = $box_h/$box_w, 290 $new_h, 291 $new_w; 292 if(($img_h > $box_h) || ($img_w > $box_w)){ 293 if($box_r < $img_r){ 294 $new_h = $box_h - 30; 295 $new_w = $box_h / $img_r 296 }else{ 297 $new_h = ($box_w * $img_r) - 30; 298 $new_w = $box_w 299 }; 300 301 }else{ 302 $new_h = $img_h; 303 $new_w = $img_w; 304 }; 305 var $left = ($(ele).data('e').s_w / 2)-($new_w / 2) + 'px', 306 $top = ($box_h / 2)-($new_h / 2) + 'px'; 307 308 $img.css({ 309 width : $new_w + 'px', 310 height : $new_h + 'px', 311 left : $left, 312 top : $top, 313 }); 314 $descr.css( 315 { 316 left : $left, 317 width : $new_w + 'px', 318 height : $new_h/4, 319 bottom : (($box_h / 2)-($new_h / 2)) + 'px', 320 }) 321 }) 322 }; 325 323 //animation________________________________________________________________________________________________________________________________ 326 324 function _rotate(ele) {
Note: See TracChangeset
for help on using the changeset viewer.