|
302 | 302 | movieBox.find('.playBtn').css('height', '30%'); |
303 | 303 | } |
304 | 304 |
|
305 | | - const playBtnTop = Math.floor((h * 0.5) - (playBtnHeight * 0.5)); |
306 | | - const playBtnLeft = Math.floor((w * 0.5) - (playBtnWidth * 0.5)); |
307 | 305 | let playTimeFontSize = Math.floor(playBtnWidth * 0.25); |
308 | 306 | if (20 < playTimeFontSize) { |
309 | 307 | playTimeFontSize = 20; |
310 | 308 | } |
311 | 309 | const playTimeTop = Math.floor(h - (2 * playTimeFontSize)); |
312 | 310 |
|
313 | 311 | movieBox.css('width', w + 'px').css('height', h + 'px'); |
314 | | - movieBox.find('.playBtn').css('top', playBtnTop + 'px').css('left', playBtnLeft + 'px'); |
| 312 | + movieBox.find('.playBtn') |
| 313 | + .css('top', '50%') |
| 314 | + .css('left', '50%') |
| 315 | + .css('transform', 'translate(-50%, -50%)'); |
315 | 316 | movieBox.find('.playTime').css('top', playTimeTop + 'px').css('font-size', playTimeFontSize + 'px'); |
316 | 317 |
|
317 | 318 | }; |
318 | 319 |
|
319 | | - // 画面が回転された場合 |
320 | | - const restore = function (obj) { |
321 | | - const target = []; |
322 | | - $(obj).each(function () { |
323 | | - const self = $(this); |
324 | | - if (!self.hasClass('movieBox') || self.hasClass('noRestore')) { |
325 | | - return; |
326 | | - } |
327 | | - const image = self.prev(); |
328 | | - self.remove(); |
329 | | - image.show(); |
330 | | - target.push(image); |
331 | | - }); |
332 | | - |
333 | | - let maxCount = target.length; |
334 | | - const movieBoxs = []; |
335 | | - $(target).each(function () { |
336 | | - new init(this).exec(function (movieBox) { |
337 | | - movieBoxs.push(movieBox); |
338 | | - maxCount--; |
339 | | - if (maxCount === 0 && callbackfunc) { |
340 | | - callbackfunc(movieBoxs); |
341 | | - } |
342 | | - }); |
343 | | - }); |
344 | | - } |
345 | | - |
346 | 320 | const target = $(this); |
347 | 321 |
|
348 | | - // 実機の場合は回転処理、それ以外はリサイズ処理 |
349 | | - if (0 > navigator.userAgent.indexOf('iPhone') && 0 > navigator.userAgent.indexOf('iPad') && 0 > navigator.userAgent.indexOf('iPod') && 0 > navigator.userAgent.indexOf('Android')) { |
350 | | -// // 画面がリサイズされた場合 |
351 | | -// $(window).resize(function() { |
352 | | -// restore(obj.next()); |
353 | | -// if (resizeCallback) { |
354 | | -// resizeCallback(obj); |
355 | | -// } |
356 | | -// }); |
357 | | - } else { |
358 | | - // 画面が回転された場合 |
359 | | - $(window).on('orientationchange', function () { |
360 | | - setTimeout(function () { |
361 | | - restore(obj.next()); |
362 | | - if (resizeCallback) { |
363 | | - resizeCallback(obj); |
364 | | - } |
365 | | - }, 200); |
366 | | - }); |
367 | | - } |
368 | | - |
369 | 322 | let maxCount = target.length; |
370 | 323 | const movieBoxs = []; |
371 | 324 | target.each(function () { |
|
0 commit comments