/********************************************* * bangdream.js *********************************************/ /* ------------------------------------------- * @init ------------------------------------------- */ $(function(){ var u = new EPOS_CARD.Util(); $.modal(); $.gt_cBox(); $.customScroll(); $(window).on('load', function (){ $.floationgControl(); }); }); /* ------------------------------------------- * @plugin ------------------------------------------- */ (function($){ /* * gt_cBox * モーダル */ $.gt_cBox = function(){ // instance var u = new EPOS_CARD.Util(); // element var $cbox = $(".bndr-cb-inline"); if($cbox.length === 0){ return false; } $cbox.colorbox({ inline: true, maxWidth: "90%", maxHeight: "95%", fixed: true, onComplete: function(){ EPOS_CARD.module.equalHeight(true, true); EPOS_CARD.module.sizeFix(); } }); }; /* * @method floationgControl * - フローティングCV制御 */ $.floationgControl = function(){ // instance var u = new EPOS_CARD.Util(); // vars var $pageContainer = $("#pageContainer"), $elm = $('.js-ec00002Floating'), closeNm = "floatingNone", $close = $(".floatingClose"), $toggleElm = $(".floating-toggle"), speed = 300; if($elm.length === 0){ return false; } // setting var slideInSpeed = 500, completeNm = "slide-in-completed"; // setting $elm.each(function() { var self = $(this); var negative = self.innerHeight() + 20 self.css("bottom", "-" + negative + "px") }); // function var floatingSet = function(){ if(!$elm.hasClass(closeNm)){ $pageContainer.css("padding-bottom", $elm.innerHeight()); } else { $pageContainer.css("padding-bottom", 0); } }; // close if($close.length !== 0){ $close.on("click",function(){ if($elm.hasClass(closeNm)){ $elm.removeClass(closeNm); $toggleElm.stop().slideDown(speed,function(){ $pageContainer.animate({"padding-bottom": $elm.innerHeight()},speed); }); } else { $elm.addClass(closeNm); $toggleElm.stop().slideUp(speed,function(){ $pageContainer.animate({"padding-bottom": 0},speed); }); } }); } // trigger floatingSet(); u.isWindowSizeCheck(function(){ floatingSet(); }); // load $elm.show(); $elm.addClass(completeNm).animate({ "bottom": 0 },slideInSpeed); }; $.modal = function(config){ var u = new EPOS_CARD.Util(); var c = $.extend({ elm: ".js-Modal" },config); // vars var $elm = $(c.elm); if($elm.length === 0){ return false; } // trigger if(!u.isRangeSP()){ $elm.colorbox({ inline: true, width: "100%", maxWidth: "1100px", maxHeight: "92%", fixed: true, onComplete: function(){ EPOS_CARD.module.equalHeight(true, true); EPOS_CARD.module.sizeFix(); } }); } else { $elm.colorbox({ inline: true, height: "", maxWidth: "100%", maxHeight: "100%", fixed: true, onComplete: function(){ EPOS_CARD.module.equalHeight(true, true); EPOS_CARD.module.sizeFix(); } }); } }, /* * 既存踏襲 * $.customScroll * カスタムスクロールバー */ $.customScroll = function(){ if($("#news_area").length === 0){ return false; } $(window).load(function(){ $("#news_area").mCustomScrollbar({ scrollButtons:{enable:true}, theme:"my-theme" }); }); }; })(jQuery);