質問編集履歴

1

jqueryソースコードの変更

2021/01/20 07:07

投稿

user20
user20

スコア31

test CHANGED
File without changes
test CHANGED
@@ -502,64 +502,48 @@
502
502
 
503
503
  fadeTimer();
504
504
 
505
- if(sideNavi == 'on'){
506
-
507
- targetObj.append('<a href="javascript:void(0);" class="btnPrev"></a><a href="javascript:void(0);" class="btnNext"></a>');
508
-
509
- var btnPrev = targetObj.find('.btnPrev'),btnNext = targetObj.find('.btnNext'),btnPrevNext = targetObj.find('.btnPrev,.btnNext');
510
-
511
- if(ua.search(/iPhone/) != -1 || ua.search(/iPad/) != -1 || ua.search(/iPod/) != -1 || ua.search(/Android/) != -1){
512
-
513
- btnPrevNext.css({opacity:naviOpc});
514
-
515
- } else {
516
-
517
- btnPrevNext.css({opacity:naviOpc}).hover(function(){
518
-
519
- $(this).stop().animate({opacity:'1'},200);
520
-
521
- },function(){
522
-
523
- $(this).stop().animate({opacity:naviOpc},200);
524
-
525
- });
526
-
527
- }
505
+ }
528
-
529
-
530
-
531
- if(sideHide == 'hide'){
506
+
532
-
533
- if(ua.search(/iPhone/) != -1 || ua.search(/iPad/) != -1 || ua.search(/iPod/) != -1 || ua.search(/Android/) != -1){
534
-
535
- btnPrevNext.css({visibility:'visible'});
536
-
537
- } else {
538
-
539
- btnPrevNext.css({visibility:'hidden'});
507
+ var setLiImg = findLi.find('img'),
540
-
508
+
541
- targetObj.hover(function(){
509
+ baseWidth = setLiImg.width(),
510
+
542
-
511
+ baseHeight = setLiImg.height(),
512
+
543
- btnPrevNext.css({visibility:'visible'});
513
+ selfWH = baseWidth / baseHeight;
544
-
514
+
545
- },function(){
515
+ function setArea(){
516
+
546
-
517
+ var wdWidth = $(window).width(),
518
+
519
+ wdHeight = $(window).height(),
520
+
547
- btnPrevNext.css({visibility:'hidden'});
521
+ rwdHeight = wdWidth / selfWH;
548
-
549
- });
522
+
550
-
551
- }
523
+
552
-
553
- }
524
+
554
-
555
- btnPrev.click(function(){switchPrev();});
525
+ if(rwdHeight < $(window).height()){
556
-
526
+
557
- btnNext.click(function(){switchNext();});
527
+ rwdHeight = $(window).height();
528
+
529
+ wdWidth = rwdHeight * selfWH;
558
530
 
559
531
  }
560
532
 
533
+ targetObj.css({height:wdHeight});
534
+
535
+ findUl.css({marginTop:-rwdHeight/2,marginLeft:-wdWidth/2,width:wdWidth,height:rwdHeight});
536
+
537
+ findLi.css({height:rwdHeight});
538
+
561
539
  }
562
540
 
541
+ $(window).resize(function(){setArea();}).resize();
542
+
543
+
544
+
545
+ $('body').css({visibility:'visible'});
546
+
563
547
  });
564
548
 
565
549
  });