$.exists = function(selector) { return ($(selector).length > 0); } $(function(){ $(".custom-scrollbar-wrapper").each(function () { if ( $("html").attr("lang") == "ko" ) { var dragTxt = "좌우로 드래그 해주세요."; console.log('ko') }else { var dragTxt = "Drag left and right."; } $(this).append("
"); var $scrollObject = $(this).find(".scroll-object-box"); if ($.exists($scrollObject)) { customScrollX($scrollObject); } $(this).on("touchmove click",function () { $(this).find(".custom-scrollbar-cover").fadeOut(200); }); }); }) function customScrollX (scrollObject) { $(scrollObject).mCustomScrollbar({ axis:"x", theme:"dark" }); } function customScrollY (scrollObject) { $(scrollObject).mCustomScrollbar({ axis:"y", theme:"dark" }); }