Created
December 13, 2020 04:58
-
-
Save UncleKo/5896a7f27f9857013fbb2532854bceee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ============================================================ | |
* | |
* @requires jquery.1.12.4.js | |
* | |
==============================================================*/ | |
!function(t){function e(){var e,i,n={height:a.innerHeight,width:a.innerWidth};return n.height||(e=r.compatMode,(e||!t.support.boxModel)&&(i="CSS1Compat"===e?f:r.body,n={height:i.clientHeight,width:i.clientWidth})),n}function i(){return{top:a.pageYOffset||f.scrollTop||r.body.scrollTop,left:a.pageXOffset||f.scrollLeft||r.body.scrollLeft}}function n(){var n,l=t(),r=0;if(t.each(d,function(t,e){var i=e.data.selector,n=e.$element;l=l.add(i?n.find(i):n)}),n=l.length)for(o=o||e(),h=h||i();n>r;r++)if(t.contains(f,l[r])){var a,c,p,s=t(l[r]),u={height:s.height(),width:s.width()},g=s.offset(),v=s.data("inview");if(!h||!o)return;g.top+u.height>h.top&&g.top<h.top+o.height&&g.left+u.width>h.left&&g.left<h.left+o.width?(a=h.left>g.left?"right":h.left+o.width<g.left+u.width?"left":"both",c=h.top>g.top?"bottom":h.top+o.height<g.top+u.height?"top":"both",p=a+"-"+c,v&&v===p||s.data("inview",p).trigger("inview",[!0,a,c])):v&&s.data("inview",!1).trigger("inview",[!1])}}var o,h,l,d={},r=document,a=window,f=r.documentElement,c=t.expando;t.event.special.inview={add:function(e){d[e.guid+"-"+this[c]]={data:e,$element:t(this)},l||t.isEmptyObject(d)||(l=setInterval(n,250))},remove:function(e){try{delete d[e.guid+"-"+this[c]]}catch(i){}t.isEmptyObject(d)&&(clearInterval(l),l=null)}},t(a).bind("scroll resize scrollstop",function(){o=h=null}),!f.addEventListener&&f.attachEvent&&f.attachEvent("onfocusin",function(){h=null})}(jQuery); | |
(function($) { | |
/* forget password */ | |
$('[name="forgetpw"]').on('change', viewTogglePswd); | |
function viewTogglePswd(e) { | |
e.preventDefault(); | |
var isCheck = $(e.currentTarget).prop('checked'); | |
var $target = $('[name="loginPassword"]').length?$('[name="loginPassword"]'):$('[name="comLoginPassword"]'); | |
if (isCheck) { | |
$target.attr('type', 'text'); | |
} else { | |
$target.attr('type', 'password'); | |
} | |
}; | |
/* smoothScroll */ | |
$.fn.smoothScroll = function(options) { | |
var config = { | |
selector: '[href^="#"]', | |
duration: 500, | |
easing: 'linear' | |
}; | |
$.extend(true, config, options); | |
var $selector = $(config.selector).not('[href="#"]').not('[data-smooth=false]'); | |
var $target = $('html, body'); | |
$selector.on('click', function() { | |
var data = $(this).data('smooth') || 0; | |
$target.stop().animate({ | |
scrollTop: $(this.hash).offset().top + data | |
}, { | |
duration: config.duration, | |
easing: config.easing | |
}); | |
return false; | |
}); | |
return this; | |
}; | |
/* openNav */ | |
$.fn.openNav = function(options) { | |
var config = { | |
closebtn: ".jq-close-nav" | |
}; | |
$.extend(true, config, options); | |
var $target = $('body'); | |
$(this).on('click', function() { | |
$target.addClass("nav-open"); | |
return false; | |
}); | |
$(config.closebtn).on('click', function() { | |
$target.removeClass("nav-open"); | |
return false; | |
}); | |
return this; | |
}; | |
/* openSearch */ | |
$.fn.openSearch = function(options) { | |
var config = {}; | |
$target = $(".header-search"); | |
$.extend(true, config, options); | |
$(this).on('click', function() { | |
if ($target.hasClass("jq-show")) { | |
$target.removeClass("jq-show"); | |
} else { | |
$target.addClass("jq-show"); | |
} | |
$(this).addClass("active"); | |
return false; | |
}).on('mouseout', function() { | |
var $target = $(this); | |
if (config.TYPE == 'campaign') { | |
camTimeoutID = setTimeout(function() { | |
$target.removeClass("active"); | |
return false; | |
}, 200); | |
} else if (config.TYPE == 'category') { | |
cateTimeoutID = setTimeout(function() { | |
$target.removeClass("active"); | |
return false; | |
}, 200); | |
} else { | |
timeoutID = setTimeout(function() { | |
$target.removeClass("active"); | |
return false; | |
}, 200); | |
} | |
}); | |
return this; | |
}; | |
/* countup */ | |
$.fn.countUp = function(options) { | |
var config = {}; | |
$.extend(true, config, options); | |
var $target = $('.jq-num-count'); | |
var maxValue = $target.attr('max'); | |
$(this).on('click', function() { | |
var i = parseInt($target.val()); | |
i = i + 1; | |
if (i > maxValue) { | |
i = maxValue | |
}; | |
$target.val(i) | |
return false; | |
}); | |
return this; | |
}; | |
/* countdown */ | |
$.fn.countDown = function(options) { | |
var config = {}; | |
$.extend(true, config, options); | |
var $target = $('.jq-num-count'); | |
$(this).on('click', function() { | |
var i = parseInt($target.val()); | |
i = i - 1; | |
if (i < 1) { | |
i = 1; | |
} | |
$target.val(i) | |
return false; | |
}); | |
return this; | |
}; | |
/* imgChangeThumb */ | |
$.fn.imgChangeThumb = function(options) { | |
var config = { | |
mainImg: ".item-detail-photo", | |
thumbImg: ".item-detail-thumb-photo" | |
}; | |
$.extend(true, config, options); | |
$self = $(this); | |
$(this).find("a").on('click', function() { | |
$self.find(".active").removeClass("active"); | |
$(this).parent(config.thumbImg).addClass("active"); | |
var i = $self.find(".active").index(); | |
$(config.mainImg).find("li.active").removeClass("active"); | |
$(config.mainImg).find("li").eq(i).addClass("active"); | |
return false; | |
}); | |
return this; | |
}; | |
/* imgZoom */ | |
$.fn.imgZoom = function(options) { | |
var config = { | |
closebtn: ".jq-close-modal a", | |
imgClass: ".modal-img" | |
}; | |
$.extend(true, config, options); | |
var $body = $('body'); | |
$(this).on('click', function() { | |
$body.append('<div class="modal photo-modal" style="display: none;"><div class="modal-inner"><div class="modal-img"></div><div class="modal-close jq-close-modal"><a href="#"></a></div></div></div>'); | |
var $target = $('.item-detail-photo-main'); | |
var src = $target.find("li.active").children("img").attr("src"); | |
setTimeout(function(){ | |
var h = $(window).innerHeight(); | |
var w = $(window).innerWidth(); | |
var ih = h > 640 ? h - 250 : h - 100; | |
var iw = w > 640 ? w - 250 : w - 100; | |
$(config.imgClass).html('<img src="' + src + '" alt="">'); | |
$(config.imgClass + " img").css({maxWidth:iw+"px",maxHeight:ih+"px"}); | |
var sh = window.pageYOffset; | |
var mh = $(".modal").innerHeight(); | |
var pt = sh + (h / 2) - (mh / 2); | |
var sw = window.pageXOffset; | |
var mw = $(".modal").innerWidth(); | |
var pl = sw + (w - mw) / 2; | |
$(".modal").css({ | |
"top": pt, | |
"left": pl, | |
"margin-top": 0, | |
"margin-left": 0 | |
}); | |
$body.addClass("modal-open"); | |
$('.overlay , .photo-modal').fadeIn("fast"); | |
}, 200); | |
return false; | |
}); | |
var closeModal = function() { | |
$('.photo-modal , .overlay').fadeOut("fast", function() { | |
$body.removeClass("modal-open"); | |
$(config.imgClass).empty(); | |
$('.photo-modal').remove(); | |
}); | |
return false; | |
}; | |
$body.on('click',config.closebtn,closeModal); | |
$('.overlay').on('click',closeModal); | |
return this; | |
}; | |
/* posFixed */ | |
$.fn.posFixed = function(options) { | |
var config = {}; | |
$.extend(true, config, options); | |
var nav = $(this), | |
offset = nav.offset(); | |
if (offset) { | |
$(window).scroll(function() { | |
if ($(".sp").css("display") == "block") { | |
nav.removeClass('jq-fixed'); | |
} else { | |
if (offset.top < $(window).scrollTop()) { | |
nav.addClass('jq-fixed'); | |
} else { | |
nav.removeClass('jq-fixed'); | |
} | |
} | |
}); | |
} | |
}; | |
/* chgFormTbl */ | |
$.fn.chgFormTbl = function(options) { | |
var config = {}; | |
$.extend(true, config, options); | |
var t = $(this).data("target"); | |
var $target = $('.' + t + '.active'); | |
$(this).on("change", function() { | |
var v = $(this).val(); | |
$target.removeClass("active"); | |
$("#" + v).addClass("active"); | |
}); | |
}; | |
/* pageToTop */ | |
$.fn.pageToTop = function(options) { | |
var config = {}; | |
$.extend(true, config, options); | |
var $target = $("#header"); | |
var $self = $(this); | |
$target.on('inview', function(event, isInView, visiblePartX, visiblePartY) { | |
if (isInView) { | |
return $self.removeClass('is-show'); | |
} else { | |
return $self.addClass('is-show'); | |
} | |
}); | |
}; | |
/* changeSort */ | |
$.fn.changeSort = function(options) { | |
var config = {}; | |
$.extend(true, config, options); | |
var $target = $(this); | |
$target.on('change', function() { | |
window.location.href = $target.val(); | |
}); | |
}; | |
})(jQuery); | |
var YFC = function() { | |
'use strict'; | |
var Util = function() {}; | |
/* | |
* 謨ー蛟、繧�3譯∝玄蛻�j縺ォ繧ォ繝ウ繝槭r謇薙▲縺ヲ霑斐☆ | |
*/ | |
Util.prototype.toThreeDigitNum = function(num) { | |
if (isNaN(num)) { | |
console.error(num + ' is not a Number'); | |
return; | |
} | |
//譁�ュ怜�縺ォ縺吶k | |
num = String(num); | |
var len = num.length; | |
//蜀榊クー逧�他縺ウ蜃コ縺� | |
if (len > 3) { | |
// 蜑榊濠繧貞シ墓焚縺ォ蜀榊クー蜻シ縺ウ蜃コ縺� + 蠕悟濠3譯� | |
return this.toThreeDigitNum(num.substring(0, len - 3)) + ',' + num.substring(len - 3); | |
} else { | |
return num; | |
} | |
}; | |
/* | |
* 3譯∝玄蛻�j謨ー蛟、縺九i繧ォ繝ウ繝槭r縺ッ縺壹☆ | |
*/ | |
Util.prototype.parseThreeDigitNum = function(numStr) { | |
if (typeof numStr !== 'string') { | |
console.error(numStr + ' is not string'); | |
return; | |
} | |
var retVal = Number(numStr.replace(/,/g, '')); | |
if (isNaN(retVal)) { | |
console.error('"' + numStr + '" cannot convert to Number'); | |
return; | |
} | |
return retVal; | |
}; | |
Util.prototype.sum = function(arr) { | |
if (!arr instanceof Array) { | |
console.error(arr + ' is not Array'); | |
return; | |
} | |
var retVal = 0; | |
arr.forEach(function(obj) { | |
if (isNaN(obj)) { | |
console.error(obj + ' is not a Number'); | |
return false; | |
} | |
retVal += obj; | |
}); | |
return retVal; | |
}; | |
this.util = new Util(); | |
}; | |
var yfc = new YFC(); | |
var imgSlide = function(target) { | |
"use strict"; | |
var W = 1280, | |
H = 440, | |
BGCOLOR = 'transparent', | |
FTCOLOR = 'transparent', | |
SCROLLSPEED = 1000, | |
CHANGESPEED = 4000, | |
NEXTIMG = '<', | |
PREVIMG = '>', | |
DIRECTION = 'reverse', | |
WIDTHLIMIT = 'on'; | |
var targetid = target; | |
var targetli = '.' + target + ' ul.main-image-sliders li'; | |
var thumid = '.main-image-indicator'; | |
var $setMainId = $('.' + targetid); | |
var $setThumbId = $(thumid); | |
var w = $setMainId.data('width') ? $setMainId.data('width') : W; | |
var h = $setMainId.data('height') ? $setMainId.data('height') : H; | |
var bgcolor = $setMainId.data('bgcolor') ? $setMainId.data('bgcolor') : BGCOLOR; | |
var ftcolor = $setMainId.data('ftcolor') ? $setMainId.data('ftcolor') : FTCOLOR; | |
var ww = $setMainId.parent().width(); | |
var direction = $setMainId.data('direction') ? $setMainId.data('direction') : DIRECTION; | |
var widthBreak = $setMainId.data('widthbreak') ? $setMainId.data('widthbreak') : WIDTHLIMIT; | |
var offsetL = 0; | |
if(widthBreak == 'off'){ | |
offsetL = ww-w > 0 ? ( ww-w )/2 : 0; | |
} | |
if (ww > w) { | |
ww = w; | |
} | |
var hh = h / (w / ww); | |
var scrollSpeed = $setMainId.data('scrollspeed') ? $setMainId.data('scrollspeed') : SCROLLSPEED, | |
changeSpeed = $setMainId.data('changespeed') ? $setMainId.data('changespeed') : CHANGESPEED; | |
var nextImg = $setMainId.data('nextimg') ? $setMainId.data('nextimg') : NEXTIMG, | |
prevImg = $setMainId.data('previmg') ? $setMainId.data('previmg') : PREVIMG; | |
var ssflg = true; | |
var moveflg = false; | |
var roop = true; | |
var $setMainUl = $setMainId.children('ul'), | |
$setThumbUl = $setThumbId.children('ul'), | |
listWidth = ww, | |
listCount = $setMainUl.children('li').length, | |
leftMax = offsetL - ((listWidth) * ((listCount) - 1)); | |
if (listCount < 2) { | |
roop = false; | |
} | |
var $next = $('.main-image-next a'); | |
var $prev = $('.main-image-prev a'); | |
if($next.html() == '') { | |
$next.html(nextImg); | |
} | |
if($prev.html() == '') { | |
$prev.html(prevImg); | |
} | |
$next.css('color', ftcolor); | |
$prev.css('color', ftcolor); | |
var ind = '<li class="indicator" style="border-color:' + ftcolor + ';"></li>'; | |
for (var i = 0; i < listCount; i++) { | |
$setThumbUl.append(ind); | |
} | |
var $setThumbLi = $setThumbUl.children('li'); | |
var $setThumbLiFirst = $setThumbUl.children('li:first'); | |
$(targetli + ' img').css({ | |
maxWidth: ww, | |
maxHeight: hh | |
}); | |
if(widthBreak == 'off') { | |
$setMainId.css({height: hh}); | |
} else { | |
$setMainId.css({width: ww,height: hh}); | |
} | |
$setMainId.parent().css({ | |
backgroundColor: bgcolor | |
}); | |
$setMainUl.each(function() { | |
$(this).css({ | |
width: (listWidth) * (listCount + 1), | |
height: hh | |
}); | |
}); | |
$(targetli).css({ | |
width: ww, | |
height: hh | |
}); | |
var firstClone = $(targetli + ':first').clone(false); | |
$setMainUl.append(firstClone); | |
var lastCloneAdd = function() { | |
var lastClone = $(targetli + ':nth-last-child(2)').clone(false); | |
$setMainUl.prepend(lastClone).css({left: offsetL - listWidth * 2}); | |
}; | |
var firstCloneAdd = function() { | |
firstClone = $(targetli + ':nth-child(2)').clone(false); | |
$setMainUl.append(firstClone); | |
}; | |
if (roop) { | |
lastCloneAdd(); | |
$setMainUl.each(function() { | |
var ulw = parseInt($(this).css("width")) + listWidth * 2; | |
$(this).css({ | |
width: ulw, | |
left: offsetL - listWidth | |
}); | |
}); | |
$(targetli + ':last').remove(); | |
} | |
$setThumbLiFirst.addClass('active').css("background-color", ftcolor); | |
var autoPlayInterval; | |
window.clearInterval(autoPlayInterval); | |
function goNextPage() { | |
if (moveflg) { | |
return false; | |
} | |
moveflg = true; | |
var index = $setThumbUl.children("li.active").index(); | |
var i = index + 1; | |
if (listCount <= i) { | |
i = 0; | |
} | |
$setThumbLi.css("background-color", "transparent").removeClass('active'); | |
$setThumbLi.eq(i).addClass('active').css("background-color", ftcolor); | |
var leftp = -(listWidth) * (i); | |
if (roop) { | |
firstCloneAdd(); | |
leftp = parseInt($setMainUl.css("left")) - listWidth; | |
$setMainUl.each(function() { | |
var ulw = parseInt($(this).css("width")) + listWidth * 2; | |
$(this).css({ | |
width: ulw | |
}); | |
}); | |
} | |
$setMainUl.stop().animate({ | |
left: leftp | |
}, scrollSpeed, function() { | |
if (roop) { | |
$(targetli + ':first').remove(); | |
$setMainUl.each(function() { | |
$(this).css({ | |
width: (listWidth) * (listCount + 1), | |
left: offsetL - listWidth | |
}); | |
moveflg = false; | |
}); | |
} | |
}); | |
} | |
function goPrevPage() { | |
if (moveflg) { | |
return false; | |
} | |
moveflg = true; | |
var index = $setThumbUl.children("li.active").index(); | |
var i = index - 1; | |
if (i < 0) { | |
i = listCount - 1; | |
} | |
$setThumbLi.css("background-color", "transparent").removeClass('active'); | |
$setThumbLi.eq(i).addClass('active').css("background-color", ftcolor); | |
var leftp = -(listWidth) * (i); | |
if (roop) { | |
lastCloneAdd(); | |
leftp = parseInt($setMainUl.css("left")) + listWidth; | |
$setMainUl.each(function() { | |
var ulw = parseInt($(this).css("width")) + listWidth * 2; | |
$(this).css({ | |
width: ulw | |
}); | |
}); | |
} | |
$setMainUl.stop().animate({ | |
left: leftp | |
}, scrollSpeed, function() { | |
if (roop) { | |
$(targetli + ':last').remove(); | |
$setMainUl.each(function() { | |
$(this).css({ | |
width: (listWidth) * (listCount + 1), | |
left: offsetL - listWidth | |
}); | |
moveflg = false; | |
}); | |
} | |
}); | |
} | |
$next.on("click", function() { | |
clearInterval(autoPlayInterval); | |
direction == 'natural' ? goPrevPage():goNextPage(); | |
autoPlay(); | |
return false; | |
}); | |
$prev.on("click", function() { | |
clearInterval(autoPlayInterval); | |
direction == 'natural' ? goNextPage():goPrevPage(); | |
autoPlay(); | |
return false; | |
}); | |
var autoPlay = function() { | |
autoPlayInterval = window.setInterval(function() { | |
if (!ssflg) { | |
return; | |
} | |
goNextPage(); | |
}, changeSpeed); | |
}; | |
autoPlay(); | |
$(window).bind("resize orientationchange", function() { | |
var ww = $setMainId.parent().width(); | |
if(widthBreak == 'off'){ | |
offsetL = ww-w > 0 ? ( ww-w )/2 : 0; | |
} | |
if (ww > w) { | |
ww = w; | |
} | |
var hh = h / (w / ww); | |
listWidth = ww; | |
if(widthBreak == 'off') { | |
$setMainId.css({height: hh}); | |
} else { | |
$setMainId.css({width: ww,height: hh}); | |
} | |
$setMainUl.each(function() { | |
$(this).css({ | |
width: (listWidth) * (listCount), | |
height: hh | |
}); | |
}); | |
$(targetli).css({ | |
width: ww, | |
height: hh | |
}); | |
$(targetli + ' img').css({ | |
maxWidth: ww, | |
maxHeight: hh | |
}); | |
listWidth = ww; | |
leftMax = offsetL - ((listWidth) * ((listCount) - 1)); | |
if (roop) { | |
$setMainUl.each(function() { | |
var ulw = parseInt($(this).css("width")) + listWidth; | |
$(this).css({ | |
width: ulw, | |
left: offsetL - listWidth | |
}); | |
}); | |
} | |
}); | |
}; | |
var imgSlideBlock = function(set) { | |
var l = set.t + ' ul li'; | |
var ul = set.t + '>ul'; | |
var lLen = $(l).length; | |
function ini() { | |
len = $(l).eq(0).width(); | |
var myUlw = len * lLen; | |
$(ul).css("width", myUlw + 'px'); | |
}; | |
ini(); | |
$(window).on('resize orientationchange', function() { | |
ini(); | |
}); | |
var snap = set.snap; | |
var overflow = set.overflow; | |
var touchable = false; | |
$(set.t).flickSimple({ | |
snap: snap, | |
overflow: overflow, | |
touchable: touchable, | |
duration: 1000, | |
onChange: function() { | |
var i = this.page - 1; | |
if (i < 0) { | |
i = 0; | |
} | |
$(set.t).find("li.active").removeClass("active"); | |
$(set.t).find("li").eq(i).addClass("active"); | |
$(".item-detail-thumb").find(".item-detail-thumb-photo.active").removeClass("active"); | |
$(".item-detail-thumb").find(".item-detail-thumb-photo").eq(i).addClass("active"); | |
if (this.page == 1) { | |
$("#" + set.btn + "backbtn").css('display', 'none'); | |
} else { | |
$("#" + set.btn + "backbtn").css('display', 'block'); | |
} | |
if (this.page == lLen) { | |
$("#" + set.btn + "nextbtn").css('display', 'none'); | |
} else { | |
$("#" + set.btn + "nextbtn").css('display', 'block'); | |
} | |
} | |
}); | |
var fsObj = $(set.t).flickSimple(); | |
$("#" + set.btn + "nextbtn").off('click'); | |
$("#" + set.btn + "nextbtn").on('click', function() { | |
fsObj.nextPage(); | |
return false; | |
}); | |
$("#" + set.btn + "backbtn").off('click'); | |
$("#" + set.btn + "backbtn").on('click', function() { | |
fsObj.prevPage(); | |
return false; | |
}); | |
if (fsObj.page == 1) { | |
$("#" + set.btn + "backbtn").css('display', 'none'); | |
} else { | |
$("#" + set.btn + "backbtn").css('display', 'block'); | |
} | |
if (fsObj.page >= lLen) { | |
$("#" + set.btn + "nextbtn").css('display', 'none'); | |
} else { | |
$("#" + set.btn + "nextbtn").css('display', 'block'); | |
} | |
$(".item-detail-thumb-photo").click(function() { | |
var index = $(this).index(); | |
fsObj.goTo(index + 1); | |
return false; | |
}); | |
/* | |
//-- | |
function changeFunc() { | |
if ( fsObj.startX !== null ) return; | |
fsObj.pageLength < fsObj.page+1 ? fsObj.goTo(1) : fsObj.nextPage(); | |
} | |
setInterval(changeFunc,5000); | |
*/ | |
}; | |
$(function() { | |
var btnHtml = $('.item-detail-cart-btn').html() + '<input type="submit" style="display:none;">'; | |
$('.item-detail-cart-btn').html(btnHtml); | |
// 繧ォ繝シ繝医�繧ソ繝ウ謚シ荳区凾蜃ヲ逅� | |
$('.raku-item-cart-action').on('click', '.raku-add-cart', function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
var value = $('[name=itemQuantity]').val(); | |
if (value == '' || isNaN(value) || Number(value) < 1 || Number(value) > 999) { | |
return; | |
}; | |
$(this).closest('form').find('input[type=submit]').click(); | |
}); | |
}); | |
$(function() { | |
$('.login-btn').on('click', 'a', function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
$(this).closest('form').find('input[type=submit]').click(); | |
}); | |
}); | |
$(function() { | |
"use strict"; | |
imgSlide("main-image-slider"); | |
imgSlideBlock({ | |
t: "#jq_item_photo_list", | |
btn: "jqitem-", | |
snap: "element", | |
overflow: "none" | |
}); | |
$(".jq-open-nav").openNav(); | |
$("body").smoothScroll(); | |
$(".item-detail-num-plus a").countUp(); | |
$(".item-detail-num-minus a").countDown(); | |
$(".item-detail-photo li").imgZoom(); | |
$(".cart-section-total").posFixed(); | |
$("#select-deli1").chgFormTbl(); | |
$("#select-pay1").chgFormTbl(); | |
$(".btn-pagetop").pageToTop(); | |
$('input[type="number"]').on('input', function() { | |
if ($(this).val().length > $(this).attr('maxlength')) | |
$(this).val($(this).val().slice(0, $(this).attr('maxlength'))); | |
}); | |
}); | |
$(document).ready(function() { | |
var cartAction = $(".raku-item-cart-action").html(); | |
$("#btnKeyword").click(function(event) { | |
if (!$('input[name="searchWord"]').val()) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
} | |
}); | |
if ($("#cms0002d02Form").length > 0) { | |
refreshVariation($("[name=variationId]:first").val()); | |
// 繝舌Μ繧ィ繝シ繧キ繝ァ繝ウ螟画峩譎� | |
$("[name=variationId]").on('change', function(e) { | |
var variationId = $(this).val(); | |
refreshVariation(variationId); | |
}); | |
function refreshVariation(variationId) { | |
var data = { | |
variationId: variationId | |
}; | |
$.ajax({ | |
url: '/getValiationData/', | |
type: 'GET', | |
async: false, | |
data: { | |
"data": JSON.stringify(data) | |
}, | |
dataType: 'json', | |
cache: true, | |
error: function(XMLHttpRequest, textStatus, errorThrown) { | |
// var form = $("#cms0002d02Form"); | |
// form.attr("action", "/timeout"); | |
// form.submit(); | |
return; | |
}, | |
success: function(data) { | |
if (data.timeoutError == 1) { | |
// var form = $("#cms0002d02Form"); | |
// form.attr("action", "/timeout"); | |
// form.submit(); | |
return; | |
} | |
$(".raku-item-photo-main").find("li:first").find("img").attr("src", data.mediaUrl); | |
$(".raku-item-thumb-photo:first").find("img").attr("src", data.mediaUrl); | |
$(".raku-item-vari-price-num").text(data.displaySalePrice); | |
$(".raku-item-vari-tax").text(data.displaySaleTax); | |
if (data.mmbrPrice != null) { | |
$(".raku-item-vari-memberprice-num").text(data.displayMmbrPrice); | |
$(".raku-item-vari-membertax").text(data.displayMmbrTax); | |
$(".raku-item-vari-memberprice-num").closest("div").show(); | |
} else { | |
$(".raku-item-vari-memberprice-num").text(""); | |
$(".raku-item-vari-membertax").text(""); | |
$(".raku-item-vari-memberprice-num").closest("div").hide(); | |
} | |
if (data.normalPrice != null) { | |
$(".raku-item-vari-normalprice-num").text(data.displayNormalPrice); | |
$(".raku-item-vari-normaltax").text(data.displayNormalTax); | |
$(".raku-item-vari-normalprice-num").closest("div").show(); | |
} else { | |
$(".raku-item-vari-normalprice-num").text(""); | |
$(".raku-item-vari-normaltax").text(""); | |
$(".raku-item-vari-normalprice-num").closest("div").hide(); | |
} | |
if (data.stock != null) { | |
if (data.itmAttrDispTypeId == 1 || data.itmAttrDispTypeId == 2) { | |
$(".raku-item-vari-stock").text(data.displayStock); | |
$(".raku-item-vari-stock").closest("div").show(); | |
} else { | |
$(".raku-item-vari-stock").closest("div").hide(); | |
} | |
if (data.stock === 0) { | |
$('.raku-item-vari-stock').addClass('item-dtail-stock0'); | |
$(".raku-item-cart-action").html("<div class='item-dtail-nostock'>蝨ィ蠎ォ蛻�l縺ョ縺溘a豕ィ譁�>縺溘□縺代∪縺帙s縲�</div>"); | |
} else { | |
$('.raku-item-vari-stock').removeClass('item-dtail-stock0'); | |
$(".raku-item-cart-action").html(cartAction); | |
} | |
} else { | |
$(".raku-item-vari-stock").text(""); | |
$(".raku-item-vari-stock").closest("div").hide(); | |
$(".raku-item-cart-action").html(cartAction); | |
} | |
if (data.itemCd != null) { | |
$(".raku-item-vari-itemcode").text(data.itemCd); | |
$(".raku-item-vari-itemcode").closest("div").show(); | |
} else { | |
$(".raku-item-vari-itemcode").text(""); | |
$(".raku-item-vari-itemcode").closest("div").hide(); | |
} | |
if (data.jancode != null) { | |
$(".raku-item-vari-jancode").text(data.jancode); | |
$(".raku-item-vari-jancode").closest("div").show(); | |
} else { | |
$(".raku-item-vari-jancode").text(""); | |
$(".raku-item-vari-jancode").closest("div").hide(); | |
} | |
} | |
}); | |
}; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment