/********************************************* * jquery.colorbox.js * ------------------------------------------- * @init * @plugin * @requires * - jquery.js * - common.js *********************************************/ /* ------------------------------------------- * @init ------------------------------------------- */ $(function(){ // モーダル内の画像をプリロード $.preloadImg = function(){ for(var i=0; i').attr('src', arguments[i]); } }; $.preloadImg("/memberservice/pc/smp/v1/cardapply/modal/img/character_im01.png"); /* 画像読み込み */ $.execColorbox({ targetElm: ".cb_photo01", colorboxName: "cb_layout01", relName: false, pc_width: "850px", tl_width: "90%", sp_width: "90%", pc_height: false, tl_height: false, sp_height: false }); /* 外部HTML読み込み */ $.execColorbox({ targetElm: ".cb_href01", colorboxName: "cb_layout01", href: true, relName: false, pc_width: "850px", tl_width: "90%", sp_width: "90%", pc_height: false, tl_height: false, sp_height: false }); $.execColorbox({ targetElm: ".cb_href_character", colorboxName: "cb_layout01", href: true, relName: false, pc_width: "550px", tl_width: false, sp_width: "90%", pc_height: false, tl_height: false, sp_height: "402px" }); $.execColorbox({ targetElm: ".cb_mail_magazine", colorboxName: "cb_layout01 mail_magazine", href: true, relName: false, pc_width: "800px", tl_width: false, sp_width: "90%", pc_height: false, tl_height: false, sp_height: false }); /* インラインHTML読み込み */ $.execColorbox({ targetElm: ".cb_inline01", colorboxName: "cb_layout01", inline: true, relName: false, pc_width: "850px", tl_width: "90%", sp_width: "90%", pc_height: false, tl_height: false, sp_height: false }); }); /* ------------------------------------------- * @plugin ------------------------------------------- */ (function($){ /* * @plugin execColorbox * - colorboxのカスタマイズ実行 */ $.execColorbox = function(config){ /* option ------------------------------- */ var c = $.extend({ containerElm: "#pageContainer", targetElm: ".cb_xxxxx00", colorboxName: "cb_layout00", inline: false, relName: "group1", opacityLevel: 0.5, pc_width: false, tl_width: false, sp_width: false, pc_height: false, tl_height: false, sp_height: false, maxWidth: false, maxHeight: false, isScalable: true, captionType: "hide", // キャプション:「hide(非表示)」or「title(タグのtitle属性)」or「before(タグの前の要素のテキスト)」or「after(タグの後の要素のテキスト)」 activeName: "cb_active" }, config); /* vars ------------------------------- */ var u = new EPOS_FORM.Util(), $container = $(c.containerElm), $elm = $(c.targetElm), focus_elm, caption = "", cb_option = { className: c.colorboxName, inline: c.inline, rel: c.relName, opacity: c.opacityLevel, width: u.isRangePC() ? c.pc_width : (u.isRangeTL() ? c.tl_width : c.sp_width), //height: u.isRangePC() ? c.pc_height : (u.isRangeTL() ? c.tl_height : c.sp_height), height: function(){ var cb_elm = $.colorbox.element(), setH = ""; if(u.isRangePC()){ if(cb_elm.hasClass("cb_fix")){ setH = cb_elm.data("cb-height"); } else { setH = c.pc_height; } } else if(u.isRangeTL()){ setH = c.tl_height; } else { setH = c.sp_height; } return setH; }, maxWidth: c.maxWidth, maxHeight: c.maxHeight, //top: u.isRangePC() ? 50 : 0, scalePhotos: c.isScalable, current: "", title: function(){ switch(c.captionType){ case "hide": caption = ""; break; case "title": caption = $(this).attr("title"); break; case "before": caption = $(this).prev().text(); break; case "after": caption = $(this).next().text(); break; default: break; } if(caption === "モーダルウィンドウで開きます"){ caption = false; } else if(caption === ""){ caption = false; } else { caption = '' + caption + ''; } return caption; }, onOpen: function(){ $container.addClass(c.activeName); }, onClosed: function(){ $container.removeClass(c.activeName); // 指定の要素にフォーカス focus_elm = $.colorbox.element().data("focus"); if(focus_elm){ $('#' + focus_elm).focus(); } } }; if($elm.length === 0){ return false; } /* init ------------------------------- */ // ロード時 //u.$win.on("load", function(){ $elm.colorbox(cb_option); //}); // リサイズ時 u.isWindowSizeCheck(function(){ if(u.isRangePC()){ $.colorbox.resize({ width: c.pc_width, height: false }); } else if(u.isRangeTL()){ $.colorbox.resize({ width: "90%", height: false }); } else { $.colorbox.resize({ width: "90%", height: false }); } }); }; })(jQuery); /* ------------------------------------------- * @plugin ------------------------------------------- */ /*! Colorbox 1.6.1 license: MIT http://www.jacklmoore.com/colorbox */ (function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in y[0]&&!y[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),y.focus())}function c(t){c.str!==t&&(y.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),y.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=(l!==!1?Math.min(h,a(l,"x")):h)-z-D,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-N-j,I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(S).hide(),y.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("
"),w()}}function p(){y||(V=!1,E=t(i),y=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),M=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),x=n(se,"Wrapper"),b=n(se,"Content").append(S=n(se,"Title"),F=n(se,"Current"),P=t('