Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <nav id="mainNavi">
    <div class="scroll-wrap">
        <div class="scroller">
            <ul class="list-nav">
                <li class="on"><a href="#">메뉴1</a></li>
                <li><a href="#">메뉴2</a></li>
                <li><a href="#">메뉴3</a></li>
                <li><a href="#">메뉴4</a></li>
                <li><a href="#">메뉴5</a></li>
                <li><a href="#">메뉴6</a></li>
                <li><a href="#">메뉴7</a></li>
                <li><a href="#">메뉴8</a></li>
                <li><a href="#">메뉴9</a></li>
                <li><a href="#">메뉴10</a></li>
            </ul>
        </div>
    </div>
</nav>   
<div id="mainCont" class="swiper-container">
    <div id="" class="swiper-wrapper">
        <div class="swiper-slide">
            <div class="orange"><span>orange</span></div>
            <div class="skyblue"><span>skyblue</span></div>
            <div class="table_cell_inblk">
                <div class="inblk"><span>인라인블락</span></div>
                <div class="table_cell">테이블셀</div>
            </div>
            <div class="purple"><span>purple</span></div>
            <div class="black"><span>black</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="grey"><span>grey</span></div>
            <div class="palevioletred"><span>palevioletred</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="black"><span>black</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="grey"><span>grey</span></div>
            <div class="palevioletred"><span>palevioletred</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="orange"><span>orange</span></div>
            <div class="skyblue"><span>skyblue</span></div>
            <div class="pink"><span>pink</span></div>
            <div class="purple"><span>purple</span></div>
            <div class="black"><span>black</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="grey"><span>grey</span></div>
            <div class="palevioletred"><span>palevioletred</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="orange"><span>orange</span></div>
            <div class="skyblue"><span>skyblue</span></div>
            <div class="pink"><span>pink</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="orange"><span>orange</span></div>
            <div class="skyblue"><span>skyblue</span></div>
            <div class="pink"><span>pink</span></div>
            <div class="purple"><span>purple</span></div>
            <div class="black"><span>black</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="orange"><span>orange</span></div>
            <div class="pink"><span>pink</span></div>
            <div class="purple"><span>purple</span></div>
            <div class="black"><span>black</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="grey"><span>grey</span></div>
            <div class="palevioletred"><span>palevioletred</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="orange"><span>orange</span></div>
            <div class="skyblue"><span>skyblue</span></div>
            <div class="table_cell_inblk">
                <div class="inblk"><span>인라인블락</span></div>
                <div class="table_cell">
                    테이블셀
                    <a href="#none">레이어팝업</a>
                </div>
            </div>
            <div class="purple"><span>purple</span></div>
            <div class="black"><span>black</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="grey"><span>grey</span></div>
            <div class="palevioletred"><span>palevioletred</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="orange"><span>orange</span></div>
            <div class="skyblue"><span>skyblue</span></div>
            <div class="pink"><span>pink</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="grey"><span>grey</span></div>
            <div class="palevioletred"><span>palevioletred</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="pink"><span>pink</span></div>
            <div class="purple"><span>purple</span></div>
            <div class="black"><span>black</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="grey"><span>grey</span></div>
            <div class="palevioletred"><span>palevioletred</span></div>
            <div class="chocolate"><span>chocolate</span></div>
            <div class="coral"><span>coral</span></div>
        </div>
        <div class="swiper-slide">
            <div class="orange"><span>orange</span></div>
            <div class="skyblue"><span>skyblue</span></div>
            <div class="pink"><span>pink</span></div>
            <div class="purple"><span>purple</span></div>
            <div class="black"><span>black</span></div>
            <div class="crimson"><span>crimson</span></div>
            <div class="grey"><span>grey</span></div>
        </div>
    </div>
</div>
              
            
!

CSS

              
                *{margin:0;padding:0;}
ul,li{list-style:none;}
a {text-decoration:none; color:#666}

.red {background:red; color:#fff; text-align:center;}
.blue {background:blue; color:#fff; text-align:center;}
.green {background:green; color:#fff; text-align:center;}
.orange {background:orange; color:#fff; text-align:center;}
.skyblue {background:skyblue; color:#fff; text-align:center;}
.pink {background:pink; color:#fff; text-align:center;}
.purple {background:purple; color:#fff; text-align:center;}
.black {background:black; color:#fff; text-align:center;}
.crimson {background:crimson; color:#fff; text-align:center;}
.grey {background:grey; color:#fff; text-align:center;}
.palevioletred {background:palevioletred; color:#fff; text-align:center;}
.chocolate {background:chocolate; color:#fff; text-align:center;}
.coral {background:coral; color:#fff; text-align:center;}

/* table > table-cell + inline-block */
.table_cell_inblk {display:table; width:100%; padding:0 20px; box-sizing:border-box;}
.table_cell_inblk .inblk {display:inline-block; width:60px; height:60px; border-radius:100%; background:cadetblue; text-align:center;}
.table_cell_inblk .inblk:before {display:inline-block; content:""; width:0; height:100%; vertical-align:middle;}
.table_cell_inblk .inblk span {display:inline-block; vertical-align:middle; line-height:1.3em;}
.table_cell_inblk .table_cell {display:table-cell; width:100%; padding-left:15px; box-sizing:border-box;}
/* =============================== */

.swiper-slide >div {height:100px;}
.swiper-slide >div:before {display:inline-block; content:""; width:0; height:100%; vertical-align:middle;}
.swiper-slide >div >span {display:inline-block; vertical-align:middle;}

/* scroller bar 보이지않게 (scroll-wrap 높이만큼 히든) */
.scroll-wrap {overflow:hidden; height:40px;}
.scroller {overflow:hidden; width:100%; height:100%; overflow-x:auto; padding-bottom:15px;}
.scroller ul {display:table; width:100%;}
.scroller ul li {display:table-cell;}
.scroller ul li a {display:block; padding:9px 10px 7px 10px; white-space:nowrap;}
.scroller ul li.on a {color:blue; font-weight:bold;}
              
            
!

JS

              
                /* userAgent.js */
!function(e){"use strict";var o=e.userAgent=function(e){function o(e){var o={},i=/(dolfin)[ \/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(e)||/(webkit)(?:.*version)?[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(e)||["","unknown"];return"webkit"===i[1]?i=/(iphone|ipad|ipod)[\S\s]*os ([\w._\-]+) like/.exec(e)||/(android)[ \/]([\w._\-]+);/.exec(e)||[i[0],"safari",i[2]]:"mozilla"===i[1]?i[1]=/trident/.test(e)?"msie":"firefox":/polaris|natebrowser|([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test(e)&&(i[1]="polaris"),o[i[1]]=!0,o.name=i[1],o.version=n(i[2]),o}function n(e){var o={},n=e?e.split(/\.|-|_/):["0","0","0"];return o.info=n.join("."),o.major=n[0]||"0",o.minor=n[1]||"0",o.patch=n[2]||"0",o}function i(e){return t(e)?"pc":r(e)?"tablet":a(e)?"mobile":""}function t(e){return e.match(/linux|windows (nt|98)|macintosh/)&&!e.match(/android|mobile|polaris|lgtelecom|uzard|natebrowser|ktf;|skt;/)?!0:!1}function r(e){return e.match(/ipad/)||e.match(/android/)&&!e.match(/mobi|mini|fennec/)?!0:!1}function a(e){return e.match(/ip(hone|od)|android.+mobile|windows (ce|phone)|blackberry|bb10|symbian|webos|firefox.+fennec|opera m(ob|in)i|polaris|iemobile|lgtelecom|nokia|sonyericsson|dolfin|uzard|natebrowser|ktf;|skt;/)?!0:!1}function s(e){var o={},i=/(iphone|ipad|ipod)[\S\s]*os ([\w._\-]+) like/.exec(e)||/(android)[ \/]([\w._\-]+);/.exec(e)||(/android/.test(e)?["","android","0.0.0"]:!1)||(/polaris|natebrowser|([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test(e)?["","polaris","0.0.0"]:!1)||/(windows)(?: nt | phone(?: os){0,1} | )([\w._\-]+)/.exec(e)||(/(windows)/.test(e)?["","windows","0.0.0"]:!1)||/(mac) os x ([\w._\-]+)/.exec(e)||(/(linux)/.test(e)?["","linux","0.0.0"]:!1)||(/webos/.test(e)?["","webos","0.0.0"]:!1)||/(bada)[ \/]([\w._\-]+)/.exec(e)||(/bada/.test(e)?["","bada","0.0.0"]:!1)||(/(rim|blackberry|bb10)/.test(e)?["","blackberry","0.0.0"]:!1)||["","unknown","0.0.0"];return"iphone"===i[1]||"ipad"===i[1]||"ipod"===i[1]?i[1]="ios":"windows"===i[1]&&"98"===i[2]&&(i[2]="0.98.0"),o[i[1]]=!0,o.name=i[1],o.version=n(i[2]),o}function w(e){var o={},i=/(crios)[ \/]([\w.]+)/.exec(e)||/(daumapps)[ \/]([\w.]+)/.exec(e)||["",""];return i[1]?(o.isApp=!0,o.name=i[1],o.version=n(i[2])):o.isApp=!1,o}return e=(e||window.navigator.userAgent).toString().toLowerCase(),{ua:e,browser:o(e),platform:i(e),os:s(e),app:w(e)}};"object"==typeof window&&window.navigator.userAgent&&(window.ua_result=o(window.navigator.userAgent)||null)}(function(){return"object"==typeof exports?(exports.daumtools=exports,exports.util=exports,exports):"object"==typeof window?(window.daumtools="undefined"==typeof window.daumtools?{}:window.daumtools,window.util="undefined"==typeof window.util?window.daumtools:window.util,window.daumtools):void 0}());

//메인스와이퍼
var mainSwiper = {
    swiper : null, //이벤트리스터 this 선언을 위함
    init : function(){
        var swiperWeb = new Swiper('.swiper-container', {
            initialSlide : 0, //Index number of initial slide.
            direction: "horizontal", //Could be 'horizontal' or 'vertical'
            autoHeight: true,
            loop: true,
            touchAngle: 30, //Allowable angle in degrees to trigger touch move
            threshold: 20, //Threshold value in px. If "touch distance" will be lower than this value then swiper will not move
            a11y: true, //Accessibility,
            touchMoveStopPropagation: true, //If enabled, then propagation of "touchmove" will be stopped
            //slidesPerView: 1,
            //spaceBetween: 40,
            // Responsive breakpoints
            /*
            breakpoints: {
                // when window width is <= 320px
                320: {
                    slidesPerView: 1,
                    spaceBetween: 10
                },
                // when window width is <= 480px
                480: {
                    slidesPerView: 2,
                    spaceBetween: 20
                },
                // when window width is <= 640px
                640: {
                    slidesPerView: 3,
                    spaceBetween: 30
                }
            },
            */
           on: {
            init: function(){
                mainSwiper.afterSlide();
            },
            slideChangeTransitionEnd: function(){
                mainSwiper.afterSlide();
            }
           }
        });
        mainSwiper.swiper = swiperWeb; //이벤트리스너 안에 this 처리를 위해

        //event
        $("#mainNavi .list-nav li a").off("click.menu").on("click.menu", function(e){
            if( $(this).parent("li").hasClass("on") ) return false;
            var index = $(this).parent("li").index();
            console.log(index);
            $("#mainNavi .list-nav li").removeClass("on").children("a").attr("aria-selected","false");
            $("#mainNavi .list-nav li:eq("+ index +")").children("a").attr("aria-selected","true");
            mainSwiper.swiper.slideTo(index+1,0); //slideTo(index,speed,callback)
            return false; //e.preventDefault() + e.stopPropagation();
            //실행후 return false 넣을것 (실행 전에 있을경우 실행자체가 안됨)
        })
    },
    afterSlide : function(){
        var index = $(".swiper-slide-active").attr("data-swiper-slide-index");
        $(".scroll-wrap .scroller ul li").removeClass("on").children("a").attr("aria-selected","false");
        $("#mainNavi .list-nav li:eq("+ index +")").addClass("on").children("a").attr("aria-selected","true");
        console.log(index);
        mainSwiper.scrollAlign();

    },
    scrollAlign : function(){
        var scrollMenuOn = $(".scroll-wrap .scroller ul li.on"),
            scroller = $(".scroll-wrap .scroller");
        scroller.animate({
            scrollLeft : scrollMenuOn.offset().left + scroller.scrollLeft() + scrollMenuOn.width()/2 - scroller.width()/2 
        }, 500);
    },
    parentFuncName : {
        childFuncName1 : function(){
            //다른곳에서 사용시
            //mainSwiper.parentFuncName.childFuncName1()
        },
        childFuncName2 : function(idx){
            //다른곳에서 사용시
            //mainSwiper.parentFuncName.childFuncName2(idx)
            //return idx;
        }
    }
}

//메인 모든 리터럴함수 호출
var main = {
    init : function(){
        mainSwiper.init();
        main.userAgent();
    },
    userAgent : function(){
        var os = "os_" + ua_result.os.name;
        var platform = ua_result.platform;
        var browser = ua_result.browser.name;
        var version = "ver_" + ua_result.browser.version.major;
        var ua = os + " " + platform + " " + browser + " " + version;
        $("body").addClass(ua);
    },
    layerPopup : {
        init : function(){

        },
        open : function(){
            
        }
    }
}


$(function(){
    main.init();
})
              
            
!
999px

Console