//jQuery-1.11.1 //var $jQ1_11 = $.noConflict(true); $(function(){ //jquery.colorbox SettingScript var confirmElm = { 'trigger' : $('.modal_on'), 'target' : $('#chkboxAlert') }; var resizeSecond = 500, resizeTimer; var htmlBody = $('body'); var colorBoxOption = function () { var baseOpt = { inline : true, opacity : 0.6, // initialWidth : 600, href : confirmElm['target'] }; //スマホ用の指定 var width = $(window).width(); //スマホ用の指定 var agent = navigator.userAgent; if(agent.match(/(iPad|iPhone|iPod|Android)/)!==null){ // if ( width < 420 ) { htmlBody.addClass('smpDisplay'); baseOpt["initialWidth"] = '80%'; baseOpt["width"] = '100%'; baseOpt["maxWidth"] = '100%'; baseOpt["maxHeight"] = '100%'; } return baseOpt; }; var $chkboxTbls = $('table.chkboxTbl'); confirmElm['trigger'].on('click', function (event) { var modal = $(this).next().html(); $("#chkboxAlert div.modalBlock div.blockInner").html(modal); var opt = colorBoxOption(); $(this).colorbox(opt); $(window).resize(function(){ if ( !resizeTimer ) { resizeTimer = true; setTimeout(function (){ $.colorbox.resize({scalePhotos:true}); if(navigator.userAgent.match(/(iPad|iPhone|iPod|Android)/)!==null){ // if ( width < 420 ) { $.colorbox.resize({width:'100%'}); } resizeTimer = false; },resizeSecond); } }); $("#cboxLoadedContent").css('overflow','visible'); event.preventDefault(); }); });