{"id":1092,"date":"2015-03-03T23:57:24","date_gmt":"2015-03-03T14:57:24","guid":{"rendered":"http:\/\/www.sriproot.net\/blog\/?p=1092"},"modified":"2015-03-04T00:06:10","modified_gmt":"2015-03-03T15:06:10","slug":"popup-window","status":"publish","type":"post","link":"https:\/\/www.sriproot.net\/blog\/popup-window-1092","title":{"rendered":"lightbox\u307f\u305f\u3044\u306a\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u30a6\u30a4\u30f3\u30c9\u30a6\u81ea\u4f5c\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p>\u6625\u304b\u3068\u601d\u3063\u305f\u3089\u305d\u3046\u6696\u304b\u304f\u306a\u308a\u307e\u305b\u3093\u306d\u3002<br \/>\n\u3067\u3082\u6885\u306f\u30ad\u30ec\u30a4\u306b\u54b2\u3044\u3066\u307e\u3059\u3088\u306d\u3047\u3002<\/p>\n<p>\u4eca\u65e5\u306fLightbox\u306e\u3088\u3046\u306a\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u30a6\u30a4\u30f3\u30c9\u30a6\u3092\u81ea\u4f5c\u3057\u305f\u304a\u8a71\u3002<br \/>\n\u4eca\u66f4\u611f\u305f\u3063\u3077\u308a\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u3002<\/p>\n<p>\u3044\u308f\u3086\u308b\u3001\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u753b\u50cf\u3092\u3075\u308f\u3063\u3068\u8868\u793a\u3059\u308b\u3002\u3063\u3066\u3084\u3064\u3067\u3059\u306d\u3002<br \/>\n\u904e\u53bb\u306b\u306f\u300c<a href=\"http:\/\/lokeshdhakar.com\/projects\/lightbox2\/\" target=\"_blank\">Lightbox<\/a>\u300d\u304b\u3089\u59cb\u307e\u3063\u3066\u3001\u300c<a href=\"http:\/\/www.no-margin-for-errors.com\/projects\/prettyPhoto-jquery-lightbox-clone\/\" target=\"_blank\">prettyPhoto<\/a>\u300d\u306a\u3093\u304b\u3082\u4f7f\u3063\u305f\u308a\u3057\u3066\u3001\u6700\u7d42\u7684\u306b\u306f\u300c<a href=\"http:\/\/www.jacklmoore.com\/colorbox\/\" target=\"_blank\">Colorbox<\/a>\u300d\u3092\u3088\u304f\u4f7f\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u3067\u3082\u30d8\u30bf\u3059\u308c\u30701\u5e74\u304f\u3089\u3044\u305d\u3046\u3044\u3046\u306e\u3092\u4f7f\u3063\u3066\u3044\u306a\u304f\u3066\u3001\u4e45\u3057\u3076\u308a\u306b\u305d\u3046\u3044\u3046\u6848\u4ef6\u304c\u3042\u3063\u305f\u306e\u3067\u3001Colorbox\u3067\u3082\u4f7f\u304a\u3046\u304b\u306a\u3041\u3002\u3068\u601d\u3063\u305f\u3093\u3067\u3059\u304c\u3001\u300e\u3044\u3084\u3001\u3082\u3057\u304b\u3057\u305f\u3089\u81ea\u4f5c\u3067\u304d\u308b\u3093\u3058\u3083\u306a\u3044\u304b\uff1f\u300f\u3068\u601d\u3063\u305f\u306e\u3067\u81ea\u4f5c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<!--more--><\/p>\n<h2>\u76ee\u6b21<\/h2>\n<ol>\n<li><a href=\"#step1\">\u3067\u304d\u3042\u304c\u308a<\/a><\/li>\n<li><a href=\"#step2\">HTML\u3068css\u3068jQuery<\/a>\n<ol>\n<li><a href=\"#step2-1\">HTML<\/a><\/li>\n<li><a href=\"#step2-2\">css<\/a><\/li>\n<li><a href=\"#step2-3\">javascript<\/a><\/li>\n<\/ol>\n<\/li>\n<li><a href=\"#step3\">\u307e\u3068\u3081<\/a><\/li>\n<\/ol>\n<h2 id=\"step1\">\u3067\u304d\u3042\u304c\u308a<\/h2>\n<p>\u307e\u305a\u306f\u5b8c\u6210\u306e\u30c7\u30e2\u304b\u3089\u3002<br \/>\n<a href=\"https:\/\/www.sriproot.net\/blog\/sample-code\/popup-window-sample\" target=\"_blank\">\u81ea\u4f5c\u30e2\u30fc\u30c0\u30eb\u30a6\u30a3\u30f3\u30c9\u30a6\u30c7\u30e2<\/a><\/p>\n<p>\u3082\u3046\u4f55\u3082\u6a5f\u80fd\u306f\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u305f\u3060\u30af\u30ea\u30c3\u30af\u3057\u3066\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u3060\u3051\u3002<br \/>\n\u6b21\u306e\u753b\u50cf\u3078\u9001\u308b\u3053\u3068\u3082\u306a\u3044\u3057\u3001\u30bf\u30a4\u30c8\u30eb\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u30b7\u30f3\u30d7\u30eb\u306alightbox\u3002\u305d\u3046\u3044\u3046\u611f\u3058\u3002<\/p>\n<h2 id=\"step2\">HTML\u3068css\u3068jQuery<\/h2>\n<p>\u4eca\u56de\u306e\u306fjQuery\u3092\u4f7f\u3044\u307e\u3059\u306e\u3067\u3001\u4e8b\u524d\u306bjQuery\u306f\u8aad\u307f\u8fbc\u3093\u3067\u304a\u3044\u3066\u4e0b\u3055\u3044\u3002<br \/>\n\u30c7\u30e2\u3092\u898b\u3066\u3082\u308f\u304b\u308a\u307e\u3059\u304c\u3001\u3042\u304f\u307e\u3067\u3082\u30d9\u30fc\u30b9\u306a\u306e\u3067\u3001\u3053\u3063\u304b\u3089\u3084\u3063\u3066\u3044\u3051\u3070\u3001\u30aa\u30d7\u30b7\u30e7\u30f3\u3064\u3051\u305f\u308a\u3067\u304d\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u3068<\/p>\n<h3 id=\"step2-1\">HTML<\/h3>\n<p>\u307e\u305a\u306f\u57fa\u672c\u7684\u306aHTML\u3067\u3059\u304c<br \/>\n[html]<\/p>\n<div id=\"thumb-list\">\n<ul>\n<li id=\"list01\" class=\"thumb\"><img decoding=\"async\" src=\"img\/thumb01.jpg\" alt=\"\u30b5\u30e0\u30cd1\"><\/li>\n<li id=\"list02\" class=\"thumb\"><img decoding=\"async\" src=\"img\/thumb02.jpg\" alt=\"\u30b5\u30e0\u30cd2\"><\/li>\n<li id=\"list03\" class=\"thumb\"><img decoding=\"async\" src=\"img\/thumb03.jpg\" alt=\"\u30b5\u30e0\u30cd3\"><\/li>\n<\/ul>\n<div id=\"pic01\" class=\"pic\"><img decoding=\"async\" src=\"img\/pic01.jpg\" alt=\"\u5199\u771f1\"><\/p>\n<div class=\"btn-close\">\u2613<\/div>\n<\/div>\n<div id=\"pic02\" class=\"pic\"><img decoding=\"async\" src=\"img\/pic02.jpg\" alt=\"\u5199\u771f2\"><\/p>\n<div class=\"btn-close\">\u2613<\/div>\n<\/div>\n<div id=\"pic03\" class=\"pic\"><img decoding=\"async\" src=\"img\/pic03.jpg\" alt=\"\u5199\u771f3\"><\/p>\n<div class=\"btn-close\">\u2613<\/div>\n<\/div>\n<\/div>\n<p>[\/html]<br \/>\n\u6700\u521d\u306b\u30b5\u30e0\u30cd\u30a4\u30eb\u3092\u4e26\u3079\u3066\u3044\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066\u305d\u306e\u5f8c\u306b\u30af\u30ea\u30c3\u30af\u3057\u305f\u6642\u306b\u8868\u793a\u3059\u308b\u8981\u7d20\u3092\u4e26\u3079\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u6b21\u306ecss\u3067\u975e\u8868\u793a\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<h3 id=\"step2-2\">css<\/h3>\n<p>[css]<br \/>\n#thumb-list ul {<br \/>\n  margin: 0;<br \/>\n  padding: 0;<br \/>\n  position: relative;<br \/>\n  list-style-type: none;<br \/>\n  overflow: hidden;<br \/>\n}<br \/>\n#thumb-list ul li {<br \/>\n  margin: 0 20px 0 0;<br \/>\n  float: left;<br \/>\n  width: 100px;<br \/>\n  cursor: pointer;<br \/>\n}<br \/>\n.pic {<br \/>\n  border: 10px solid #efefef;<br \/>\n  border-radius: 10px;<br \/>\n  display: none;<br \/>\n  position: fixed;<br \/>\n  z-index: 10;<br \/>\n}<br \/>\n.btn-close {<br \/>\n  border: 3px solid #efefef;<br \/>\n  border-radius: 50%;<br \/>\n  width: 25px;<br \/>\n  height: 25px;<br \/>\n  position: absolute;<br \/>\n  top: -15px;<br \/>\n  right: -15px;<br \/>\n  background: #fff;<br \/>\n  font-size: 10px;<br \/>\n  cursor: pointer;<br \/>\n  text-align: center;<br \/>\n}<br \/>\n.back-layer {<br \/>\n  width: 100%;<br \/>\n  height: 100%;<br \/>\n  position:fixed;<br \/>\n  top:0;<br \/>\n  left:0;<br \/>\n  background: rgba( 255, 255, 255, 0.7);<br \/>\n}<br \/>\n[\/css]<br \/>\nHTML\u3067\u4f7f\u3063\u3066\u3044\u306a\u3044\u90e8\u5206\u3092\u3044\u304f\u3064\u304b\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u308c\u306f\u6b21\u306eJavascript\u306e\u65b9\u3067\u3002<\/p>\n<h3 id=\"step2-3\">Javascript<\/h3>\n<p>[javascript]<br \/>\n$(function(){<br \/>\n\t\/\/\u30b5\u30e0\u30cd\u30a4\u30eb\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7<br \/>\n\t$(&#8216;#thumb-list ul li&#8217;).click(function(){<br \/>\n\t\t\/\/\u4f55\u756a\u76ee\u306e\u8981\u7d20\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u304b<br \/>\n\t\tvar thumb_num = $(&#8216;#thumb-list ul li&#8217;).index(this);<br \/>\n\t\t\/\/0\u304b\u3089\u59cb\u307e\u308b\u306e\u30671\u8db3\u3057\u3066\u304a\u304f<br \/>\n\t\tthumb_num = thumb_num+1;<br \/>\n\t\t\/\/\u5927\u304d\u3044\u5199\u771f\u306eID\u3092\u8a2d\u5b9a<br \/>\n\t\tvar p_box = &#8216;#pic0&#8217; + thumb_num;<br \/>\n\t\t\/\/\u30a6\u30a3\u30f3\u30c9\u30a6\u5e45\u3001\u9ad8\u3055\u3092\u53d6\u5f97<br \/>\n\t\tvar w = $(window).width();<br \/>\n\t\tvar h = $(window).height();<br \/>\n\t\t\/\/\u5927\u304d\u3044\u5199\u771f\u306e\u5e45\u3001\u9ad8\u3055\u3092\u53d6\u5f97<br \/>\n\t\tvar pw = $(p_box).outerWidth(true);<br \/>\n\t\tvar ph = $(p_box).outerHeight(true);<br \/>\n\t\t\/\/\u4e2d\u592e\u5bc4\u305b\u306e\u8a08\u7b97<br \/>\n\t\t$(p_box).css({&#8220;left&#8221;: ((w-pw)\/2) + &#8220;px&#8221;,&#8221;top&#8221;: ((h-ph)\/2) + &#8220;px&#8221;})<\/p>\n<p>\t\t\/\/\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4\u3092\u8868\u793a<br \/>\n\t\t$(&#8216;body&#8217;).append(&#8216;<\/p>\n<div class=\"back-layer\"><\/div>\n<p>&#8216;);<br \/>\n\t\t$(&#8216;.back-layer&#8217;).fadeIn(&#8216;slow&#8217;);<br \/>\n\t\t\/\/\u5199\u771f\u3092\u8868\u793a<br \/>\n\t\t$(p_box).fadeIn(&#8220;slow&#8221;);<\/p>\n<p>\t\t\/\/\u9589\u3058\u308b\u30dc\u30bf\u30f3\u51e6\u7406<br \/>\n\t\t\/\/\u30dc\u30bf\u30f3\u30af\u30ea\u30c3\u30af\u3001\u5468\u308a\u30af\u30ea\u30c3\u30af\u3067\u95a2\u6570\u3092\u524a\u9664<br \/>\n\t\t$(&#8216;.back-layer,.btn-close&#8217;).unbind().click(function(){<br \/>\n\t\t\t\/\/\u5199\u771f\u3092\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8<br \/>\n\t\t\t$(&#8220;.pic&#8221;).fadeOut(&#8220;slow&#8221;,function(){<br \/>\n\t\t\t\t\/\/\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8\u3057\u305f\u3089\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4\u3092\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8<br \/>\n\t\t\t\t$(&#8216;.back-layer&#8217;).fadeOut(&#8216;slow&#8217;,function() {<br \/>\n\t\t\t\t\t\/\/\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8\u3057\u305f\u3089\u30aa\u30fc\u30d0\u30ec\u30a4\u3092\u6d88\u3059<br \/>\n\t\t\t\t\t$(&#8216;.back-layer&#8217;).remove();<br \/>\n\t\t\t\t});<br \/>\n\t\t\t});<br \/>\n\t\t});<br \/>\n\t});<br \/>\n});<br \/>\n[\/javascript]<br \/>\n\u4e00\u5fdc\u30b3\u30e1\u30f3\u30c8\u306e\u3068\u304a\u308a\u306a\u3093\u3067\u3001\u6539\u3081\u3066\u8aac\u660e\u3059\u308b\u3068\u3053\u308d\u3082\u306a\u3044\u3093\u3067\u3059\u304c\u3001outerWidth\u306e\u90e8\u5206\u3067\u82e5\u5e72\u30cf\u30de\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3042\u3068\u306f\u9589\u3058\u308b\u51e6\u7406\u3068\u304b\u3002<\/p>\n<h2 id=\"step3\">\u307e\u3068\u3081<\/h2>\n<p>\u3053\u308c\u3067\u51fa\u6765\u4e0a\u304c\u308a\u3067\u3059\u3002<br \/>\n\u3042\u3068\u306f\u3001\u6307\u5b9a\u3059\u308b\u30b5\u30e0\u30cd\u30a4\u30eb\u306e\u3068\u3053\u308d\u3068\u304b\u3001\u753b\u50cf\u306ealt\u3092\u53d6\u5f97\u3059\u308b\u3068\u304b\u3063\u3066\u90e8\u5206\u3092\u4ed8\u3051\u52a0\u3048\u3066\u3044\u304f\u3068\u3001\u5c11\u3057\u5e45\u304c\u5e83\u304c\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u307b\u3093\u3068\u4eca\u66f4\u611f\u305f\u3063\u3077\u308a\u3067\u81ea\u5206\u3067\u60a9\u3093\u3067\u4f5c\u308b\u304f\u3089\u3044\u306a\u3089\u3001\u3069\u3063\u304b\u304b\u3089\u6301\u3063\u3066\u304d\u305f\u304c\u65e9\u3044\u308f\u3002\u3068\u3044\u3046\u611f\u3058\u306b\u3082\u306a\u308a\u307e\u3059\u306d\u3002<\/p>\n<p>HTML5\u3068css3\u304c\u3060\u3044\u3076\u4f7f\u3048\u308b\u74b0\u5883\u306b\u306a\u308a\u3064\u3064\u3042\u308b\u306e\u3067\u3001jQuery\u306b\u4f9d\u5b58\u3057\u3066\u3044\u305f\u90e8\u5206\u3082\u5c11\u3057\u305a\u3064\u305d\u3063\u3061\u306b\u79fb\u884c\u3059\u308b\u3093\u3067\u3057\u3087\u3046\u304b\u306d\u3047\u3002<br \/>\n\u500b\u4eba\u7684\u306b\u306f\u52d5\u304d\u3068\u3044\u3046\u304b\u3001\u306a\u304f\u3066\u3082\u6210\u308a\u7acb\u3064\u90e8\u5206\u306fJS\u306b\u4efb\u305b\u305f\u3044\u306e\u3067\u3001\u307e\u3060\u307e\u3060\u306a\u304f\u306a\u3089\u306a\u3044\u304b\u306a\u3041\u3002\u3068\u601d\u3046\u3093\u3067\u3059\u3051\u3069\u306d\u3002<\/p>\n<p>\u3082\u3057\u4e0a\u306e\u30b3\u30fc\u30c9\u3067\u52d5\u304b\u306a\u3044\u3068\u304b\u3001\u3082\u3063\u3068\u826f\u3044\u66f8\u304d\u65b9\u304c\u3042\u308b\u3088\u3002\u3068\u304b\u3042\u308c\u3070\u6559\u3048\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3042\u308a\u304c\u305f\u3044\u3067\u3059\u3002<br \/>\n\u305d\u3044\u304e\uff5e\u3002<\/p>\n<blockquote>\n<p>Written with <a href=\"https:\/\/stackedit.io\/\">StackEdit<\/a>.<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u6625\u304b\u3068\u601d\u3063\u305f\u3089\u305d\u3046\u6696\u304b\u304f\u306a\u308a\u307e\u305b\u3093\u306d\u3002 \u3067\u3082\u6885\u306f\u30ad\u30ec\u30a4\u306b\u54b2\u3044\u3066\u307e\u3059\u3088\u306d\u3047\u3002 \u4eca\u65e5&#8230;<\/p>\n","protected":false},"author":2,"featured_media":1100,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[37,133],"tags":[64,166],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts\/1092"}],"collection":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/comments?post=1092"}],"version-history":[{"count":0,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts\/1092\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/media\/1100"}],"wp:attachment":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/media?parent=1092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/categories?post=1092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/tags?post=1092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}