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
 b.fn.fancybox.defaults = {
        padding: 10,
        margin: 40,
        opacity: false,
        modal: false,
        cyclic: true,
        scrolling: "auto",
        width: 560,
        height: 340,
        autoScale: true,
        autoDimensions: true,
        centerOnScroll: false,
        ajax: {},
        swf: {
            wmode: "transparent"
        },
        hideOnOverlayClick: true,
        hideOnContentClick: false,
        overlayShow: true,
        overlayOpacity: 0.7,
        overlayColor: "#777",
        titleShow: true,
        titlePosition: "float",
        titleFormat: null,
        titleFromAlt: false,
        transitionIn: "fade",
        transitionOut: "fade",
        speedIn: 300,
        speedOut: 300,
        changeSpeed: 300,
        changeFade: "fast",
        easingIn: "swing",
        easingOut: "swing",
        showCloseButton: true,
        showNavArrows: true,//화살표 표시
        enableEscapeButton: false,
        enableKeyboardNav: true,
        onStart: function() {},
        onCancel: function() {},
        onComplete: function() {},
        onCleanup: function() {},
        onClosed: function() {},
        onError: function() {}
    };
cs


해당 옵션중에 Cycle이 기본적으로 default로 되어 있는데 이부분을 true로 주고


원래 이미지가 끝날때 마다 if 조건문 주던 부분을 지우고

아이콘을 보여주는걸로 수정하면된다.




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
 Y = function() {
            if (d.enableEscapeButton || d.enableKeyboardNav) b(document).bind("keydown.fb"function(a) {
                if (a.keyCode == 27 && d.enableEscapeButton) {
                    a.preventDefault();
                    b.fancybox.close()
                } else if ( (a.keyCode == 37 || a.keyCode == 39&& d.enableKeyboardNav && a.target.tagName !== "INPUT" && a.target.tagName !== "TEXTAREA" && a.target.tagName !== "SELECT") {
                    a.preventDefault();
                    b.fancybox[a.keyCode == 37 ? "prev" : "next"]()
                }
            });
            if (d.showNavArrows) {
                //#fancybox-left-ico, #fancybox-right-ico css로 위치조정
                if (d.cyclic && l.length > 1 || p !== 0){
                    if( p == l.length-1){
                        //공정화면에서 맨마지막 사진일때 list 처음으로~
                        p = -1;
                    }
                    z.show();
                }
                if (d.cyclic && l.length > 1 || p != l.length - 1){
                    if(p == 0 ){
                        //공정화면에서 처음사진일때  list left click, right click
                        p = l.length;
                        z.show();
                    }//if
                    A.show();
                } 
            } else {
                z.hide();
                A.hide()
            }
        },
cs

삽질했던 나의 코드를~~

1
2
3
4
5
6
7
8
9
10
11
12
13
14
= function() {
            if (d.enableEscapeButton || d.enableKeyboardNav) b(document).bind("keydown.fb"function(a) {
                if (a.keyCode == 27 && d.enableEscapeButton) {
                    a.preventDefault();
                    b.fancybox.close()
                } else if ( (a.keyCode == 37 || a.keyCode == 39&& d.enableKeyboardNav && a.target.tagName !== "INPUT" && a.target.tagName !== "TEXTAREA" && a.target.tagName !== "SELECT") {
                    a.preventDefault();
                    b.fancybox[a.keyCode == 37 ? "prev" : "next"]()
                }
            });
                //#fancybox-left-ico, #fancybox-right-ico css로 위치조정
                z.show();
                A.show()
        },
cs




설정을 바꾼후 테스트 하러 ㄱㄱ~~

+ Recent posts