/* * requires:jQuery v1.10.1 later * name:settings.js * author:Manabu Kushimoto(web-park.org) */ var GN={ ww:function(){ var v=$(window).innerWidth(); return v; }, wh:function(){ var v=$(window).innerHeight(); return v; }, dh:function(){ var v=Math.max.apply(null,[document.body.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.documentElement.clientHeight]); return v; }, wrap:function(){ var v=$(".wrap").innerWidth(); return v; }, st:function(){ var v=$(window).scrollTop(); return v; }, ua:navigator.userAgent } jQuery(function($){ $.fn.extend({ // ページ内スクロール pageScroll:function(options){ var defaults={ speed:800 }; var op=$.extend(defaults,options); var $t=$(this); $t.on("click",function(){ var Hash=$(this.hash); try{ var HashOffset=$(Hash).offset().top; }catch(e){ return false; } $("html:not(:animated),body:not(:animated)").animate({ scrollTop: HashOffset },op.speed); return false; }); }, // レスポンシブル responsible:function(options){ var defaults={ w:{ tablet:1000, sp:700 }, products:$("#products_list .item_list > li,#related_item .item_list > li") }; var op=$.extend(defaults,options); var $t=$(this); // 商品一覧画像を正方形に保つ var productsList=function(){ op.products.each(function(){ var $photo=$(this).find(".photo"); var w={ photo:$photo.width(), img:$photo.find("img").width() } var h={ photo:$photo.height(), img:$photo.find("img").height() } if(GN.ww()w.photo/h.img){ $photo.find("img").width("auto").height(w.photo); }else{ $photo.find("img").width("100%").height("auto"); } }else{ $photo.find("img").width("auto").height("auto"); } }); } $t.on({ "load":function(){ productsList(); }, "resize":function(){ productsList(); } }); }, // サイトメニュー siteMenu:function(options){ var defaults={ speed:300 }; var op=$.extend(defaults,options); var $t=$(this); var $id=$($t.attr("href")); var h=0; $t.on("click",function(){ $id.show().css({ opacity:0 }); h=$id.height(); $id.css({ top:-h+"px" }).animate({ top:0, opacity:1 },op.speed); }); $id.find(".btn_close a").on("click",function(){ $id.animate({ top:-h+"px", opacity:0 },op.speed); }); }, // ホバースライド hoverSlide:function(options){ var defaults={ speed:300, interval:0, limit:function(){ var v=(GN.ww()>700)?7:4; return v; } }; var op=$.extend(defaults,options); var $t=$(this); var $frame=$t.find(".frame"); var $move=$t.find(".move"); var $li=$move.find("li"); var direct={ prev:$('