Mobile Phones
Tablets Watches Galaxy Buds Accessories Galaxy SGalaxy's fastest chipset and epic camera Galaxy ZUnfold your world Galaxy Z Flip4 Bespoke StudioGet your way Galaxy AGalaxy innovation made accessible for all CompareSee how our smartphones stack up Smartphone AccessoriesCases and more All SmartphonesExplore all Galaxy smartphones
Find your Galaxy Z Get matched with your ideal foldable phone.
* Image simulated. Flex mode supported at angles between 75° and 115°. ** S Pen Fold Edition and S Pen Pro sold separately. Galaxy Buds2 Pro sold separately.
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
How do you unwind?
(Video) Best Budget 5G Phones To Buy Right Now! (Under $300)
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Time to find your new foldable.
* Image simulated. Flex mode supported at angles between 75° and 115°.
Your world unfolds with…
Galaxy Z Flip3 5G
Shine on, expressor! Show off your best angles with this fantastic foldable.
Your world unfolds with…
Galaxy Z Flip4
Okay, trendsetter! Get ready to slay with the newest, most pocketable Galaxy Z Flip yet.
(Video) The smart way to buy a used phone online
Your world unfolds with…
Galaxy Z Fold4
Hey there, trailblazer! You know how to maximise every moment, and so does this phone.
Your world unfolds with…
Galaxy Z Fold4
Hey there, trailblazer! You know how to maximise every moment, and so does this phone.
NewGalaxy S23 | S23+Galaxy S23 | S23+Buy now
Galaxy Z Fold4Galaxy Z Fold4Buy now
NewGalaxy S23 Ultra AccessoriesGalaxy S23 Ultra AccessoriesLearn more
Galaxy Z Flip4Galaxy Z Flip4Customise now
NewGalaxy S23|S23+ AccessoriesGalaxy S23|S23+ AccessoriesLearn more
Galaxy Z Unfold your world
Your Galaxy. Your Way. Your Galaxy. Your Way. Galaxy Z Flip4 Bespoke Edition
Galaxy Z Flip4 Bespoke Edition
(Video) Top 5 BEST Budget Smartphones of [2023]
Galaxy S23 Ultra Galaxy S23 Ultra Online Exclusive Only available at Samsung.com
Online Exclusive Only available at Samsung.com
Buy now
(Video) The Best Samsung Phones To Buy Under $300!
Introducing the all new Galaxy A series
Find your Galaxy A
Pick your budget Affordable Mid-range Latest-tech
Pick your favorite features 2-Day Battery Fast Charging Camera with OIS Quad Camera High-resolution Camera Storage Expandable Storage Memory Big screen Super AMOLED Super smooth scrolling 5G Infinity-O Display Stereo speaker Processor ","
"],s="yx"===i.axis?"mCSB_vertical_horizontal":"x"===i.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===i.axis?l[0]+l[1]:"x"===i.axis?l[1]:l[0],u="yx"===i.axis?"
":"",f=i.autoHideScrollbar?" "+d[6]:"",h="x"!==i.axis&&"rtl"===n.langDir?" "+d[7]:"";i.setWidth&&t.css("width",i.setWidth),i.setHeight&&t.css("height",i.setHeight),i.setLeft="y"!==i.axis&&"rtl"===n.langDir?"989999px":i.setLeft,t.addClass(o+" _"+a+"_"+n.idx+f+h).wrapInner("
");var m=e("#mCSB_"+n.idx),p=e("#mCSB_"+n.idx+"_container");"y"===i.axis||i.advanced.autoExpandHorizontalScroll||p.css("width",x(p)),"outside"===i.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),m.addClass("mCSB_outside").after(c)):(m.addClass("mCSB_inside").append(c),p.wrap(u)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},x=function(t){var o=[t[0].scrollWidth,Math.max.apply(Math,t.children().map(function(){return e(this).outerWidth(!0)}).get())],a=t.parent().width();return o[0]>a?o[0]:o[1]>a?o[1]:"100%"},_=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mCSB_"+o.idx+"_container");if(n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis){i.css({width:"auto","min-width":0,"overflow-x":"scroll"});var r=Math.ceil(i[0].scrollWidth);3===n.advanced.autoExpandHorizontalScroll||2!==n.advanced.autoExpandHorizontalScroll&&r>i.parent().width()?i.css({width:r,"min-width":"100%","overflow-x":"inherit"}):i.css({"overflow-x":"inherit",position:"absolute"}).wrap("
(Video) Unlocked Galaxy Z Fold 4 vs Carrier Galaxy Z Fold 4 Differences
").css({width:Math.ceil(i[0].getBoundingClientRect().right+.4)-Math.floor(i[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap()}},w=function(){var t=e(this),o=t.data(a),n=o.opt,i=e(".mCSB_"+o.idx+"_scrollbar:first"),r=oe(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",l=[" "," "," "," "],s=["x"===n.axis?l[2]:l[0],"x"===n.axis?l[3]:l[1],l[2],l[3]];n.scrollButtons.enable&&i.prepend(s[0]).append(s[1]).next(".mCSB_scrollTools").prepend(s[2]).append(s[3])},S=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")],l=[n.height()/i.outerHeight(!1),n.width()/i.outerWidth(!1)],c=[parseInt(r[0].css("min-height")),Math.round(l[0]*r[0].parent().height()),parseInt(r[1].css("min-width")),Math.round(l[1]*r[1].parent().width())],d=s&&c[1]
r&&(r=s),c>l&&(l=c),[r>n.height(),l>n.width()]},B=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mCSB_"+o.idx),r=e("#mCSB_"+o.idx+"_container"),l=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")];if(Q(t),("x"!==n.axis&&!o.overflowed[0]||"y"===n.axis&&o.overflowed[0])&&(l[0].add(r).css("top",0),G(t,"_resetY")),"y"!==n.axis&&!o.overflowed[1]||"x"===n.axis&&o.overflowed[1]){var s=dx=0;"rtl"===o.langDir&&(s=i.width()-r.outerWidth(!1),dx=Math.abs(s/o.scrollRatio.x)),r.css("left",s),l[1].css("left",dx),G(t,"_resetX")}},T=function(){function t(){r=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(r),W.call(o[0])):t()},100)}var o=e(this),n=o.data(a),i=n.opt;if(!n.bindEvents){if(I.call(this),i.contentTouchScroll&&D.call(this),E.call(this),i.mouseWheel.enable){var r;t()}P.call(this),U.call(this),i.advanced.autoScrollOnFocus&&H.call(this),i.scrollButtons.enable&&F.call(this),i.keyboard.enable&&q.call(this),n.bindEvents=!0}},k=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=".mCSB_"+o.idx+"_scrollbar",l=e("#mCSB_"+o.idx+",#mCSB_"+o.idx+"_container,#mCSB_"+o.idx+"_container_wrapper,"+r+" ."+d[12]+",#mCSB_"+o.idx+"_dragger_vertical,#mCSB_"+o.idx+"_dragger_horizontal,"+r+">a"),s=e("#mCSB_"+o.idx+"_container");n.advanced.releaseDraggableSelectors&&l.add(e(n.advanced.releaseDraggableSelectors)),n.advanced.extraDraggableSelectors&&l.add(e(n.advanced.extraDraggableSelectors)),o.bindEvents&&(e(document).add(e(!A()||top.document)).unbind("."+i),l.each(function(){e(this).unbind("."+i)}),clearTimeout(t[0]._focusTimeout),$(t[0],"_focusTimeout"),clearTimeout(o.sequential.step),$(o.sequential,"step"),clearTimeout(s[0].onCompleteTimeout),$(s[0],"onCompleteTimeout"),o.bindEvents=!1)},M=function(t){var o=e(this),n=o.data(a),i=n.opt,r=e("#mCSB_"+n.idx+"_container_wrapper"),l=r.length?r:e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[s[0].find(".mCSB_dragger"),s[1].find(".mCSB_dragger")];"x"!==i.axis&&(n.overflowed[0]&&!t?(s[0].add(c[0]).add(s[0].children("a")).css("display","block"),l.removeClass(d[8]+" "+d[10])):(i.alwaysShowScrollbar?(2!==i.alwaysShowScrollbar&&c[0].css("display","none"),l.removeClass(d[10])):(s[0].css("display","none"),l.addClass(d[10])),l.addClass(d[8]))),"y"!==i.axis&&(n.overflowed[1]&&!t?(s[1].add(c[1]).add(s[1].children("a")).css("display","block"),l.removeClass(d[9]+" "+d[11])):(i.alwaysShowScrollbar?(2!==i.alwaysShowScrollbar&&c[1].css("display","none"),l.removeClass(d[11])):(s[1].css("display","none"),l.addClass(d[11])),l.addClass(d[9]))),n.overflowed[0]||n.overflowed[1]?o.removeClass(d[5]):o.addClass(d[5])},O=function(t){var o=t.type,a=t.target.ownerDocument!==document&&null!==frameElement?[e(frameElement).offset().top,e(frameElement).offset().left]:null,n=A()&&t.target.ownerDocument!==top.document&&null!==frameElement?[e(t.view.frameElement).offset().top,e(t.view.frameElement).offset().left]:[0,0];switch(o){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return a?[t.originalEvent.pageY-a[0]+n[0],t.originalEvent.pageX-a[1]+n[1],!1]:[t.originalEvent.pageY,t.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],r=t.originalEvent.touches.length||t.originalEvent.changedTouches.length;return t.target.ownerDocument!==document?[i.screenY,i.screenX,r>1]:[i.pageY,i.pageX,r>1];default:return a?[t.pageY-a[0]+n[0],t.pageX-a[1]+n[1],!1]:[t.pageY,t.pageX,!1]}},I=function(){function t(e,t,a,n){if(h[0].idleTimer=d.scrollInertia<233?250:0,o.attr("id")===f[1])var i="x",s=(o[0].offsetLeft-t+n)*l.scrollRatio.x;else var i="y",s=(o[0].offsetTop-e+a)*l.scrollRatio.y;G(r,s.toString(),{dir:i,drag:!0})}var o,n,i,r=e(this),l=r.data(a),d=l.opt,u=a+"_"+l.idx,f=["mCSB_"+l.idx+"_dragger_vertical","mCSB_"+l.idx+"_dragger_horizontal"],h=e("#mCSB_"+l.idx+"_container"),m=e("#"+f[0]+",#"+f[1]),p=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m,g=d.advanced.extraDraggableSelectors?e(!A()||top.document).add(e(d.advanced.extraDraggableSelectors)):e(!A()||top.document);m.bind("contextmenu."+u,function(e){e.preventDefault()}).bind("mousedown."+u+" touchstart."+u+" pointerdown."+u+" MSPointerDown."+u,function(t){if(t.stopImmediatePropagation(),t.preventDefault(),ee(t)){c=!0,s&&(document.onselectstart=function(){return!1}),L.call(h,!1),Q(r),o=e(this);var a=o.offset(),l=O(t)[0]-a.top,u=O(t)[1]-a.left,f=o.height()+a.top,m=o.width()+a.left;f>l&&l>0&&m>u&&u>0&&(n=l,i=u),C(o,"active",d.autoExpandScrollbar)}}).bind("touchmove."+u,function(e){e.stopImmediatePropagation(),e.preventDefault();var a=o.offset(),r=O(e)[0]-a.top,l=O(e)[1]-a.left;t(n,i,r,l)}),e(document).add(g).bind("mousemove."+u+" pointermove."+u+" MSPointerMove."+u,function(e){if(o){var a=o.offset(),r=O(e)[0]-a.top,l=O(e)[1]-a.left;if(n===r&&i===l)return;t(n,i,r,l)}}).add(p).bind("mouseup."+u+" touchend."+u+" pointerup."+u+" MSPointerUp."+u,function(){o&&(C(o,"active",d.autoExpandScrollbar),o=null),c=!1,s&&(document.onselectstart=null),L.call(h,!0)})},D=function(){function o(e){if(!te(e)||c||O(e)[2])return void(t=0);t=1,b=0,C=0,d=1,y.removeClass("mCS_touch_action");var o=I.offset();u=O(e)[0]-o.top,f=O(e)[1]-o.left,z=[O(e)[0],O(e)[1]]}function n(e){if(te(e)&&!c&&!O(e)[2]&&(T.documentTouchScroll||e.preventDefault(),e.stopImmediatePropagation(),(!C||b)&&d)){g=K();var t=M.offset(),o=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(o),W.push(a),z[2]=Math.abs(O(e)[0]-z[0]),z[3]=Math.abs(O(e)[1]-z[1]),B.overflowed[0])var i=D[0].parent().height()-D[0].height(),r=u-o>0&&o-u>-(i*B.scrollRatio.y)&&(2*z[3]0&&a-f>-(l*B.scrollRatio.x)&&(2*z[2]30)){_=1e3/(v-p);var n="mcsEaseOut",i=2.5>_,r=i?[E[E.length-2],W[W.length-2]]:[0,0];x=i?[o-r[0],a-r[1]]:[o-h,a-m];var u=[Math.abs(x[0]),Math.abs(x[1])];_=i?[Math.abs(x[0]/4),Math.abs(x[1]/4)]:[_,_];var f=[Math.abs(I[0].offsetTop)-x[0]*l(u[0]/_[0],_[0]),Math.abs(I[0].offsetLeft)-x[1]*l(u[1]/_[1],_[1])];w="yx"===T.axis?[f[0],f[1]]:"x"===T.axis?[null,f[1]]:[f[0],null],S=[4*u[0]+T.scrollInertia,4*u[1]+T.scrollInertia];var y=parseInt(T.contentTouchScroll)||0;w[0]=u[0]>y?w[0]:0,w[1]=u[1]>y?w[1]:0,B.overflowed[0]&&s(w[0],S[0],n,"y",L,!1),B.overflowed[1]&&s(w[1],S[1],n,"x",L,!1)}}}function l(e,t){var o=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?o[0]:o[3]:e>60?t>3?o[3]:o[2]:e>30?t>8?o[1]:t>6?o[0]:t>4?t:o[2]:t>8?t:o[3]}function s(e,t,o,a,n,i){e&&G(y,e.toString(),{dur:t,scrollEasing:o,dir:a,overwrite:n,drag:i})}var d,u,f,h,m,p,g,v,x,_,w,S,b,C,y=e(this),B=y.data(a),T=B.opt,k=a+"_"+B.idx,M=e("#mCSB_"+B.idx),I=e("#mCSB_"+B.idx+"_container"),D=[e("#mCSB_"+B.idx+"_dragger_vertical"),e("#mCSB_"+B.idx+"_dragger_horizontal")],E=[],W=[],R=0,L="yx"===T.axis?"none":"all",z=[],P=I.find("iframe"),H=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k],U=void 0!==document.body.style.touchAction&&""!==document.body.style.touchAction;I.bind(H[0],function(e){o(e)}).bind(H[1],function(e){n(e)}),M.bind(H[0],function(e){i(e)}).bind(H[2],function(e){r(e)}),P.length&&P.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind(H[0],function(e){o(e),i(e)}).bind(H[1],function(e){n(e)}).bind(H[2],function(e){r(e)})})})},E=function(){function o(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,o){d.type=o&&i?"stepped":"stepless",d.scrollAmount=10,j(r,e,t,"mcsLinearOut",o?60:null)}var i,r=e(this),l=r.data(a),s=l.opt,d=l.sequential,u=a+"_"+l.idx,f=e("#mCSB_"+l.idx+"_container"),h=f.parent();f.bind("mousedown."+u,function(){t||i||(i=1,c=!0)}).add(document).bind("mousemove."+u,function(e){if(!t&&i&&o()){var a=f.offset(),r=O(e)[0]-a.top+f[0].offsetTop,c=O(e)[1]-a.left+f[0].offsetLeft;r>0&&r0&&cr?n("on",38):r>h.height()&&n("on",40)),"y"!==s.axis&&l.overflowed[1]&&(0>c?n("on",37):c>h.width()&&n("on",39)))}}).bind("mouseup."+u+" dragend."+u,function(){t||(i&&(i=0,n("off",null)),c=!1)})},W=function(){function t(t,a){if(Q(o),!z(o,t.target)){var r="auto"!==i.mouseWheel.deltaFactor?parseInt(i.mouseWheel.deltaFactor):s&&t.deltaFactor<100?100:t.deltaFactor||100,d=i.scrollInertia;if("x"===i.axis||"x"===i.mouseWheel.axis)var u="x",f=[Math.round(r*n.scrollRatio.x),parseInt(i.mouseWheel.scrollAmount)],h="auto"!==i.mouseWheel.scrollAmount?f[1]:f[0]>=l.width()?.9*l.width():f[0],m=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),p=c[1][0].offsetLeft,g=c[1].parent().width()-c[1].width(),v="y"===i.mouseWheel.axis?t.deltaY||a:t.deltaX;else var u="y",f=[Math.round(r*n.scrollRatio.y),parseInt(i.mouseWheel.scrollAmount)],h="auto"!==i.mouseWheel.scrollAmount?f[1]:f[0]>=l.height()?.9*l.height():f[0],m=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),p=c[0][0].offsetTop,g=c[0].parent().height()-c[0].height(),v=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||((i.mouseWheel.invert||t.webkitDirectionInvertedFromDevice)&&(v=-v),i.mouseWheel.normalizeDelta&&(v=0>v?-1:1),(v>0&&0!==p||0>v&&p!==g||i.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),t.deltaFactor<5&&!i.mouseWheel.normalizeDelta&&(h=t.deltaFactor,d=17),G(o,(m-v*h).toString(),{dir:u,dur:d}))}}if(e(this).data(a)){var o=e(this),n=o.data(a),i=n.opt,r=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],d=e("#mCSB_"+n.idx+"_container").find("iframe");d.length&&d.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+r,function(e,o){t(e,o)})})}),l.bind("mousewheel."+r,function(e,o){t(e,o)})}},R=new Object,A=function(t){var o=!1,a=!1,n=null;if(void 0===t?a="#empty":void 0!==e(t).attr("id")&&(a=e(t).attr("id")),a!==!1&&void 0!==R[a])return R[a];if(t){try{var i=t.contentDocument||t.contentWindow.document;n=i.body.innerHTML}catch(r){}o=null!==n}else{try{var i=top.document;n=i.body.innerHTML}catch(r){}o=null!==n}return a!==!1&&(R[a]=o),o},L=function(e){var t=this.find("iframe");if(t.length){var o=e?"auto":"none";t.css("pointer-events",o)}},z=function(t,o){var n=o.nodeName.toLowerCase(),i=t.data(a).opt.mouseWheel.disableOver,r=["select","textarea"];return e.inArray(n,i)>-1&&!(e.inArray(n,r)>-1&&!e(o).is(":focus"))},P=function(){var t,o=e(this),n=o.data(a),i=a+"_"+n.idx,r=e("#mCSB_"+n.idx+"_container"),l=r.parent(),s=e(".mCSB_"+n.idx+"_scrollbar ."+d[12]);s.bind("mousedown."+i+" touchstart."+i+" pointerdown."+i+" MSPointerDown."+i,function(o){c=!0,e(o.target).hasClass("mCSB_dragger")||(t=1)}).bind("touchend."+i+" pointerup."+i+" MSPointerUp."+i,function(){c=!1}).bind("click."+i,function(a){if(t&&(t=0,e(a.target).hasClass(d[12])||e(a.target).hasClass("mCSB_draggerRail"))){Q(o);var i=e(this),s=i.find(".mCSB_dragger");if(i.parent(".mCSB_scrollTools_horizontal").length>0){if(!n.overflowed[1])return;var c="x",u=a.pageX>s.offset().left?-1:1,f=Math.abs(r[0].offsetLeft)-u*(.9*l.width())}else{if(!n.overflowed[0])return;var c="y",u=a.pageY>s.offset().top?-1:1,f=Math.abs(r[0].offsetTop)-u*(.9*l.height())}G(o,f.toString(),{dir:c,scrollEasing:"mcsEaseInOut"})}})},H=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=e("#mCSB_"+o.idx+"_container"),l=r.parent();r.bind("focusin."+i,function(){var o=e(document.activeElement),a=r.find(".mCustomScrollBox").length,i=0;o.is(n.advanced.autoScrollOnFocus)&&(Q(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(i+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ae(o)[0],ae(o)[1]],a=[r[0].offsetTop,r[0].offsetLeft],s=[a[0]+e[0]>=0&&a[0]+e[0]=0&&a[0]+e[1]a");s.bind("contextmenu."+r,function(e){e.preventDefault()}).bind("mousedown."+r+" touchstart."+r+" pointerdown."+r+" MSPointerDown."+r+" mouseup."+r+" touchend."+r+" pointerup."+r+" MSPointerUp."+r+" mouseout."+r+" pointerout."+r+" MSPointerOut."+r+" click."+r,function(a){function r(e,o){i.scrollAmount=n.scrollButtons.scrollAmount,j(t,e,o)}if(a.preventDefault(),ee(a)){var l=e(this).attr("class");switch(i.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===i.type)return;c=!0,o.tweenRunning=!1,r("on",l);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===i.type)return;c=!1,i.dir&&r("off",l);break;case"click":if("stepped"!==i.type||o.tweenRunning)return;r("on",l)}}})},q=function(){function t(t){function a(e,t){r.type=i.keyboard.scrollType,r.scrollAmount=i.keyboard.scrollAmount,"stepped"===r.type&&n.tweenRunning||j(o,e,t)}switch(t.type){case"blur":n.tweenRunning&&r.dir&&a("off",null);break;case"keydown":case"keyup":var l=t.keyCode?t.keyCode:t.which,s="on";if("x"!==i.axis&&(38===l||40===l)||"y"!==i.axis&&(37===l||39===l)){if((38===l||40===l)&&!n.overflowed[0]||(37===l||39===l)&&!n.overflowed[1])return;"keyup"===t.type&&(s="off"),e(document.activeElement).is(u)||(t.preventDefault(),t.stopImmediatePropagation(),a(s,l))}else if(33===l||34===l){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Q(o);var f=34===l?-1:1;if("x"===i.axis||"yx"===i.axis&&n.overflowed[1]&&!n.overflowed[0])var h="x",m=Math.abs(c[0].offsetLeft)-f*(.9*d.width());else var h="y",m=Math.abs(c[0].offsetTop)-f*(.9*d.height());G(o,m.toString(),{dir:h,scrollEasing:"mcsEaseInOut"})}}else if((35===l||36===l)&&!e(document.activeElement).is(u)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===i.axis||"yx"===i.axis&&n.overflowed[1]&&!n.overflowed[0])var h="x",m=35===l?Math.abs(d.width()-c.outerWidth(!1)):0;else var h="y",m=35===l?Math.abs(d.height()-c.outerHeight(!1)):0;G(o,m.toString(),{dir:h,scrollEasing:"mcsEaseInOut"})}}}var o=e(this),n=o.data(a),i=n.opt,r=n.sequential,l=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),d=c.parent(),u="input,textarea,select,datalist,keygen,[contenteditable='true']",f=c.find("iframe"),h=["blur."+l+" keydown."+l+" keyup."+l];f.length&&f.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind(h[0],function(e){t(e)})})}),s.attr("tabindex","0").bind(h[0],function(e){t(e)})},j=function(t,o,n,i,r){function l(e){u.snapAmount&&(f.scrollAmount=u.snapAmount instanceof Array?"x"===f.dir[0]?u.snapAmount[1]:u.snapAmount[0]:u.snapAmount);var o="stepped"!==f.type,a=r?r:e?o?p/1.5:g:1e3/60,n=e?o?7.5:40:2.5,s=[Math.abs(h[0].offsetTop),Math.abs(h[0].offsetLeft)],d=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],m="x"===f.dir[0]?s[1]+f.dir[1]*(d[1]*n):s[0]+f.dir[1]*(d[0]*n),v="x"===f.dir[0]?s[1]+f.dir[1]*parseInt(f.scrollAmount):s[0]+f.dir[1]*parseInt(f.scrollAmount),x="auto"!==f.scrollAmount?v:m,_=i?i:e?o?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",w=!!e;return e&&17>a&&(x="x"===f.dir[0]?s[1]:s[0]),G(t,x.toString(),{dir:f.dir[0],scrollEasing:_,dur:a,onComplete:w}),e?void(f.dir=!1):(clearTimeout(f.step),void(f.step=setTimeout(function(){l()},a)))}function s(){clearTimeout(f.step),$(f,"step"),Q(t)}var c=t.data(a),u=c.opt,f=c.sequential,h=e("#mCSB_"+c.idx+"_container"),m="stepped"===f.type,p=u.scrollInertia<26?26:u.scrollInertia,g=u.scrollInertia<1?17:u.scrollInertia;switch(o){case"on":if(f.dir=[n===d[16]||n===d[15]||39===n||37===n?"x":"y",n===d[13]||n===d[15]||38===n||37===n?-1:1],Q(t),oe(n)&&"stepped"===f.type)return;l(m);break;case"off":s(),(m||c.tweenRunning&&f.dir)&&l(!0)}},Y=function(t){var o=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===o.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===o.axis?null:t,n[1]=t.x?t.x:t.y||"y"===o.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},X=function(t,o){if(null!=t&&"undefined"!=typeof t){var n=e(this),i=n.data(a),r=i.opt,l=e("#mCSB_"+i.idx+"_container"),s=l.parent(),c=typeof t;o||(o="x"===r.axis?"x":"y");var d="x"===o?l.outerWidth(!1)-s.width():l.outerHeight(!1)-s.height(),f="x"===o?l[0].offsetLeft:l[0].offsetTop,h="x"===o?"left":"top";switch(c){case"function":return t();case"object":var m=t.jquery?t:e(t);if(!m.length)return;return"x"===o?ae(m)[1]:ae(m)[0];case"string":case"number":if(oe(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(d*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(f-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var p=f+parseInt(t.split("+=")[1]);return p>=0?0:Math.abs(p)}if(-1!==t.indexOf("px")&&oe(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(s.height()-l.outerHeight(!1));if("right"===t)return Math.abs(s.width()-l.outerWidth(!1));if("first"===t||"last"===t){var m=l.find(":"+t);return"x"===o?ae(m)[1]:ae(m)[0]}return e(t).length?"x"===o?ae(e(t))[1]:ae(e(t))[0]:(l.css(h,t),void u.update.call(null,n[0]))}}},N=function(t){function o(){return clearTimeout(f[0].autoUpdate),0===l.parents("html").length?void(l=null):void(f[0].autoUpdate=setTimeout(function(){return c.advanced.updateOnSelectorChange&&(s.poll.change.n=i(),s.poll.change.n!==s.poll.change.o)?(s.poll.change.o=s.poll.change.n,void r(3)):c.advanced.updateOnContentResize&&(s.poll.size.n=l[0].scrollHeight+l[0].scrollWidth+f[0].offsetHeight+l[0].offsetHeight+l[0].offsetWidth,s.poll.size.n!==s.poll.size.o)?(s.poll.size.o=s.poll.size.n,void r(1)):!c.advanced.updateOnImageLoad||"auto"===c.advanced.updateOnImageLoad&&"y"===c.axis||(s.poll.img.n=f.find("img").length,s.poll.img.n===s.poll.img.o)?void((c.advanced.updateOnSelectorChange||c.advanced.updateOnContentResize||c.advanced.updateOnImageLoad)&&o()):(s.poll.img.o=s.poll.img.n,void f.find("img").each(function(){n(this)}))},c.advanced.autoUpdateTimeout))}function n(t){function o(e,t){return function(){return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(d[2]),r(2)}if(e(t).hasClass(d[2]))return void r();var n=new Image;n.onload=o(n,a),n.src=t.src}function i(){c.advanced.updateOnSelectorChange===!0&&(c.advanced.updateOnSelectorChange="*");var e=0,t=f.find(c.advanced.updateOnSelectorChange);return c.advanced.updateOnSelectorChange&&t.length>0&&t.each(function(){e+=this.offsetHeight+this.offsetWidth}),e}function r(e){clearTimeout(f[0].autoUpdate),u.update.call(null,l[0],e)}var l=e(this),s=l.data(a),c=s.opt,f=e("#mCSB_"+s.idx+"_container");return t?(clearTimeout(f[0].autoUpdate),void $(f[0],"autoUpdate")):void o()},V=function(e,t,o){return Math.round(e/t)*t-o},Q=function(t){var o=t.data(a),n=e("#mCSB_"+o.idx+"_container,#mCSB_"+o.idx+"_container_wrapper,#mCSB_"+o.idx+"_dragger_vertical,#mCSB_"+o.idx+"_dragger_horizontal");n.each(function(){Z.call(this)})},G=function(t,o,n){function i(e){return s&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function r(){return[c.callbacks.alwaysTriggerOffsets||w>=S[0]+y,c.callbacks.alwaysTriggerOffsets||-B>=w]}function l(){var e=[h[0].offsetTop,h[0].offsetLeft],o=[x[0].offsetTop,x[0].offsetLeft],a=[h.outerHeight(!1),h.outerWidth(!1)],i=[f.height(),f.width()];t[0].mcs={content:h,top:e[0],left:e[1],draggerTop:o[0],draggerLeft:o[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-i[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-i[1])),direction:n.dir}}var s=t.data(a),c=s.opt,d={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(d,n),u=[n.dur,n.drag?0:n.dur],f=e("#mCSB_"+s.idx),h=e("#mCSB_"+s.idx+"_container"),m=h.parent(),p=c.callbacks.onTotalScrollOffset?Y.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?Y.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(s.trigger=n.trigger,0===m.scrollTop()&&0===m.scrollLeft()||(e(".mCSB_"+s.idx+"_scrollbar").css("visibility","visible"),m.scrollTop(0).scrollLeft(0)),"_resetY"!==o||s.contentReset.y||(i("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),s.contentReset.y=1),"_resetX"!==o||s.contentReset.x||(i("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),s.contentReset.x=1),"_resetY"!==o&&"_resetX"!==o){if(!s.contentReset.y&&t[0].mcs||!s.overflowed[0]||(i("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),s.contentReset.x=null),!s.contentReset.x&&t[0].mcs||!s.overflowed[1]||(i("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),s.contentReset.x=null),c.snapAmount){var v=c.snapAmount instanceof Array?"x"===n.dir?c.snapAmount[1]:c.snapAmount[0]:c.snapAmount;o=V(o,v,c.snapOffset)}switch(n.dir){case"x":var x=e("#mCSB_"+s.idx+"_dragger_horizontal"),_="left",w=h[0].offsetLeft,S=[f.width()-h.outerWidth(!1),x.parent().width()-x.width()],b=[o,0===o?0:o/s.scrollRatio.x],y=p[1],B=g[1],T=y>0?y/s.scrollRatio.x:0,k=B>0?B/s.scrollRatio.x:0;break;case"y":var x=e("#mCSB_"+s.idx+"_dragger_vertical"),_="top",w=h[0].offsetTop,S=[f.height()-h.outerHeight(!1),x.parent().height()-x.height()],b=[o,0===o?0:o/s.scrollRatio.y],y=p[0],B=g[0],T=y>0?y/s.scrollRatio.y:0,k=B>0?B/s.scrollRatio.y:0}b[1]<0||0===b[0]&&0===b[1]?b=[0,0]:b[1]>=S[1]?b=[S[0],S[1]]:b[0]=-b[0],t[0].mcs||(l(),i("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(h[0].onCompleteTimeout),J(x[0],_,Math.round(b[1]),u[1],n.scrollEasing),!s.tweenRunning&&(0===w&&b[0]>=0||w===S[0]&&b[0]<=S[0])||J(h[0],_,Math.round(b[0]),u[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!s.tweenRunning&&(i("onScrollStart")&&(l(),c.callbacks.onScrollStart.call(t[0])),s.tweenRunning=!0,C(x),s.cbOffsets=r())},onUpdate:function(){n.callbacks&&n.onUpdate&&i("whileScrolling")&&(l(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(h[0].onCompleteTimeout);var e=h[0].idleTimer||0;h[0].onCompleteTimeout=setTimeout(function(){i("onScroll")&&(l(),c.callbacks.onScroll.call(t[0])),i("onTotalScroll")&&b[1]>=S[1]-T&&s.cbOffsets[0]&&(l(),c.callbacks.onTotalScroll.call(t[0])),i("onTotalScrollBack")&&b[1]<=k&&s.cbOffsets[1]&&(l(),c.callbacks.onTotalScrollBack.call(t[0])),s.tweenRunning=!1,h[0].idleTimer=0,C(x,"hide")},e)}}})}},J=function(e,t,o,a,n,i,r){function l(){S.stop||(x||m.call(),x=K()-v,s(),x>=S.time&&(S.time=x>S.time?x+f-(x-S.time):x+f-1,S.time0?(S.currVal=u(S.time,_,b,a,n),w[t]=Math.round(S.currVal)+"px"):w[t]=o+"px",p.call()}function c(){f=1e3/60,S.time=x+f,h=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return s(),setTimeout(e,.01)},S.id=h(l)}function d(){null!=S.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(S.id):clearTimeout(S.id),S.id=null)}function u(e,t,o,a,n){switch(n){case"linear":case"mcsLinear":return o*e/a+t;case"mcsLinearOut":return e/=a,e--,o*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?o/2*e*e+t:(e--,-o/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?o/2*Math.pow(2,10*(e-1))+t:(e--,o/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?o/2*e*e*e+t:(e-=2,o/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-o*(e*e*e*e-1)+t;case"easeOutStrong":return o*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var i=(e/=a)*e,r=i*e;return t+o*(.499999999999997*r*i+-2.5*i*i+5.5*r+-6.5*i+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var f,h,r=r||{},m=r.onStart||function(){},p=r.onUpdate||function(){},g=r.onComplete||function(){},v=K(),x=0,_=e.offsetTop,w=e.style,S=e._mTween[t];"left"===t&&(_=e.offsetLeft);var b=o-_;S.stop=0,"none"!==i&&d(),c()},K=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},Z=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],o=0;o=0&&a[0]+ae(n)[0]=0&&a[1]+ae(n)[1]=0&&r[1]-i[1]*l[1][0]<0&&r[1]+n[1]-i[1]*l[1][1]>=0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var o=e(t).data(a);if(o)return o.overflowed[0]||o.overflowed[1]}})})})});(function ($) { var cbox = (function () { var items = $('.cbox__input'); var init = function () { items.each(function () { $(this).on('change', function () { $(this).closest('.cbox').toggleClass('cbox--checked'); if ($(this).closest('.cbox').hasClass('cbox--checked')) { $(this).closest('.tfilter').addClass('tfilter--disabled'); $(this).closest('.tfilter').find('.tfilter__input').prop('disabled', true); $(this).closest('.tfilter').find('.tfilter__input').attr({ tabindex: '-1', 'aria-hidden': 'true' }); $(this).closest('.tfilter').find('.tfilter__price-item-list, .tfilter__feature-item-list').attr({ 'aria-hidden': 'true' }); } else { $(this).closest('.tfilter').removeClass('tfilter--disabled'); $(this).closest('.tfilter').find('.tfilter__input').prop('disabled', false); $(this).closest('.tfilter').find('.tfilter__input').removeAttr('tabindex aria-hidden'); $(this).closest('.tfilter').find('.tfilter__price-item-list, .tfilter__feature-item-list').removeAttr('aria-hidden'); } }); }); }; return { init: function () { init(); } }; })(); cbox.init(); var fdHistoryOrigin = window.history.length; var fdHistoryCurrent = fdHistoryOrigin; var fdReadyToBack = true; var fdPageForwarded = true; var fdDefaultParams = window.location.search; var $finderPopupFirstEl = null; var fdHisotryState = function () { history.pushState({ id: 'finder' }, null, ''); }; var fdSetParamFunc = function (_id) { var fdDefaultParams = window.location.search; fdDefaultParams = fdDefaultParams.indexOf('?') > -1 ? fdDefaultParams.replace(/(&|\?)(showroom)(=a\d+_?(\w{2,3})?-?\w*)?/g, '').replace(/(&|\?)(pop[0-9]=on)/g, '') : ''; history.replaceState({ id: 'finder' }, null, fdDefaultParams + (fdDefaultParams.length ? '&' : '?') + 'pop' + _id + '=on'); }; var popup = (function () { var target = $('.l-popup'); var pWindow = target.find('.l-popup__window'); var pWindowContent = pWindow.find('.l-popup__window-content'); var swipeCloseBtn = target.find('.l-popup__swipe-close'); var currId = target.data('popup-id'); var closeBtnDragging = false; var interactPos = { x: 0, y: 0 }; var dragStartOffset = 0; var windowHeight = pWindow.height(); var bodyScroll; var setTarget = function (_id) { target = $(".l-popup[data-popup-id='" + _id + "']"); pWindow = target.find('.l-popup__window'); pWindowContent = pWindow.find('.l-popup__window-content'); swipeCloseBtn = target.find('.l-popup__swipe-close'); currId = target.data('popup-id'); }; var open = function (_id) { setTarget(_id); bodyScroll = bodyScroll >= 0 ? bodyScroll : $(".t-popup__call[data-popup-id='" + _id + "']") .closest('.finder-bnn') .offset().top; pWindowContent.css('opacity', ''); $('html').addClass('s-popup--show'); $('#wrap').attr({ 'aria-hidden': 'true', tabindex: -1 }); $('#wrap, #teconsent').find('a, button, input, select').attr({ tabindex: '-1', 'aria-hidden': 'true' }); target.attr({ 'aria-hidden': 'false' }).addClass('l-popup--active'); target.find('.cui__row--price .cui__row-title-box').attr({ tabindex: 0 }).focus(); target.find('.cui__row--price .cui__row-title').focus(); setTimeout(function () { target.find('.cui__row--price .cui__row-title-box').removeAttr('tabindex'); }, 70); // if (window.innerWidth <= 767) { // setMoHeight(); // } setParam.init(_id); // scrChk(); addScrollbar(); $('#wrap').css('transform', 'translateY(' + -bodyScroll + 'px)'); target.find('.cui__row--price .cbox__input, .cui__lnk, .l-popup__close-btn').focus(function () { // pWindowContent.find(".l-popup__inner").mCustomScrollbar("scrollTo", "top"); pWindowContent.animate({ scrollTop: 0 }, 0); }); target.find('.cui__row--feature .tfilter__feature-item-list:first-child .tfilter__input--feature').focusin(function () { pWindowContent.animate( { scrollTop: pWindowContent.find('.cui__row--feature').position().top + 'px' }, 0 ); }); tabFunc(); fdSetParamFunc(_id); ++fdHistoryOrigin; ++fdHistoryCurrent; fdReadyToBack = false; fdPageForwarded = false; }; var close = function (_id) { $('#wrap').css('transform', ''); $('html, body').animate({ scrollTop: bodyScroll }, 0); $('html').removeClass('s-popup--show'); var $curBnnBtn = $(".t-popup__call[data-popup-id='" + _id + "']"); $('#wrap').attr('aria-hidden', 'false').removeAttr('tabindex'); $('#wrap, #teconsent').find('a, button, input, select').removeAttr('tabindex aria-hidden'); target.attr({ 'aria-hidden': 'true' }).removeClass('l-popup--active'); target.find('.tfilter__input').removeAttr('tabindex aria-hidden'); target.find('.tfilter__price-item-list, .tfilter__feature-item-list').removeAttr('aria-hidden'); $curBnnBtn.focus(); setTimeout(function () { if ($curBnnBtn.is(':focus') === false) { $curBnnBtn.focus(); } }, 100); if (window.innerWidth <= 767) { pWindowContent.animate({ scrollTop: 0 }, 0); } var fdDefaultParams = window.location.search; fdDefaultParams = fdDefaultParams.indexOf('?') > -1 ? fdDefaultParams.replace(/(&|\?)(pop[0-9]=on)/g, '') : ''; history.replaceState({ id: 'finder' }, null, window.location.origin + window.location.pathname + fdDefaultParams); fdReadyToBack = true; fdPageForwarded = false; }; var dragStart = function (e) { setTarget($(this).closest('.l-popup').data('popup-id')); dragStartOffset = pWindow[0].getBoundingClientRect().top; windowHeight = pWindow.height(); pWindow.addClass('l-popup__window--dragging'); closeBtnDragging = true; dragMove(e); }; var dragMove = function (e) { if (closeBtnDragging) { var newPos = e.clientY !== undefined ? e.clientY : e.touches[0].clientY; newPos -= dragStartOffset; newPos = newPos < 0 ? 0 : newPos; pWindow.css('transform', 'translate(0, ' + newPos + 'px)'); var newOpacity = (newPos / windowHeight) * 1.3; newOpacity = newOpacity < 0 ? 0 : newOpacity > 1 ? 1 : newOpacity; pWindowContent.css('opacity', 1 - newOpacity); interactPos.y = newPos; } }; var dragEnd = function (e) { $('.cui').css('user-select', 'auto'); $('.cui').removeClass('cui--dragging'); if (closeBtnDragging) { pWindow.removeClass('l-popup__window--dragging'); pWindow.css('transform', ''); if (interactPos.y > 50) { $('.finder-bnn[data-finder-bnn=' + currId + ']') .find('.btn-finder-seo--back') .trigger('click'); close(currId); } closeBtnDragging = false; setParam.init(currId); } }; var tabFunc = function () { $finderPopupFirstEl = target.find('.cui__row--price .cui__row-title'); }; // var scrChk = function () { // var $scrBtnEl = pWindowContent.find(".finder-scr__btn"); // var scrPos = pWindowContent.scrollTop(); // if (scrPos === 0) { // $scrBtnEl.removeClass("finder-scr__btn--hidden"); // } else { // $scrBtnEl.addClass("finder-scr__btn--hidden"); // } // }; var addScrollbar = function () { var $popInr = pWindowContent.find('.l-popup__inner'); if (window.innerWidth <= 767) { if ($popInr.hasClass('mCustomScrollbar')) $popInr.mCustomScrollbar('disable', true); } else { if (!$popInr.hasClass('mCustomScrollbar')) { $popInr.mCustomScrollbar({ scrollInertia: 100, scrollbarPosition: 'outside' }); } else { $popInr.mCustomScrollbar('disable', true); $popInr.mCustomScrollbar('update'); } } }; return { init: function () { // Popup Open $('.t-popup__call').on('click', function () { bodyScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; open($(this).data('popup-id')); fdHisotryState(); }); // Popup Close $('.l-popup__bot-btn--cancel, .l-popup__close-btn').on('click', function () { fdHistoryOrigin = window.history.length; fdHistoryCurrent = window.history.length; close(currId); }); // pWindowContent.on("scroll", function () { // scrChk(); // }); // $(".finder-scr__btn").on("click", function () { // pWindowContent.animate({ // scrollTop: pWindowContent.find(".cui__row--feature").position().top + "px" // }, 200); // setTimeout(function () { // pWindowContent.find(".cui__row--feature .cui__row-title").focus(); // }, 200); // }); // Result $('.l-popup__bot-btn--result').on('click', function () { var filterQuery = ''; filterQuery = '//www.samsung.com/au/smartphones/all-smartphones/?galaxy-a'; target.find('.tfilter').each(function (_i, _v) { if (!$(this).hasClass('tfilter--disabled')) { if ($(this).data('param')) { filterQuery += '+' + $(this).data('param'); } } }); $(this).attr('href', filterQuery); }); // Drag start swipeCloseBtn.on('mousedown touchstart', dragStart); // Drag move $(document).on('mousemove touchmove', swipeCloseBtn, dragMove); // Drag end $(document).on('mouseup touchend', swipeCloseBtn, dragEnd); swipeCloseBtn.on('click', function () { close($(this).closest('.l-popup').data('popup-id')); }); // custom scroll bar var timer; var delta = 200; $(window).resize(function () { clearTimeout(timer); timer = setTimeout(function () { addScrollbar(); }); }); // browser back/ forward button clicked window.addEventListener('popstate', function () { if (fdReadyToBack) { // click popup close button if (fdHistoryCurrent !== fdHistoryOrigin) { // click forward button if (window.location.search.match(/(\?pop|&pop)/)) { popup.open(currId); $('.finder-bnn[data-finder-bnn=' + currId + ']') .find('.btn-finder-seo--forward') .trigger('click'); } } else { if (!fdPageForwarded && (history.state === null || history.state.id.match('finder'))) { fdPageForwarded = true; window.history.go(-1); } else { // page from forward if (history.state.id.match('finder') != null) popup.open(currId); } } // click back button on browser } else { popup.close(currId); ++fdHistoryCurrent; $('.finder-bnn[data-finder-bnn=' + currId + ']') .find('.btn-finder-seo--back') .trigger('click'); } }); }, open: function (_id) { open(_id); }, close: function (_id) { close(_id); }, tabFunc: function () { tabFunc(); } }; })(); popup.init(); var setParam = (function () { var featureString = ''; var $popEl = null; var dFflag; var defaultArr = []; var acrArr = []; var init = function (_id) { $popEl = $(".l-popup[data-popup-id='" + _id + "']"); dFflag = false; $popEl.find(".tfilter__input--price[data-default='true']").prop({ checked: true }); $popEl.find('.tfilter').removeClass('tfilter--disabled'); $popEl.find('.tfilter__input--feature').prop({ checked: false, disabled: false }); $popEl.find('.cbox__input').prop('checked', false); $popEl.find('.cbox').removeClass('cbox--checked'); }; var set = function () { featureString = ''; $popEl.find('.tfilter__input--feature').prop({ checked: false }); // init price param $popEl.find('.tfilter__input--price').each(function (_i, _v) { $(_v).prop({ disabled: false }); if ($(_v).is(':checked')) { $(_v).closest('.tfilter').data('param', $(_v).data('val')); if ($(_v).data('default-feature')) { defaultArr = []; defaultArr = $(_v).data('default-feature').split(','); } } }); if (defaultArr.length > 0) { $(defaultArr).each(function (_i, _v) { $popEl.find('.tfilter__input--feature[data-val=' + defaultArr[_i] + ']').prop('checked', true); }); } // init feature param $popEl.find('.tfilter__input--feature').each(function (_i, _v) { if ($(_v).is(':checked')) { featureString += (featureString.length > 0 ? '+' : '') + $(_v).data('val'); $(_v).closest('.tfilter').data('param', featureString); } }); }; var addTagging = function () { var resultDataOmni = $popEl.find('.l-popup__bot-btn--result').data('omni'); acrArr = []; $popEl.find('[data-acr]').each(function () { if ($(this).is(':checked') && !$(this).is(':disabled')) { acrArr.push($(this).data('acr')); } }); var resultStr = resultDataOmni + '^' + acrArr.join('-'); $popEl.find('.l-popup__bot-btn--result').attr({ 'data-omni': resultStr, 'ga-la': resultStr }); }; return { init: function (_id) { init(_id); set(); addTagging(); // change price param $popEl.find('.tfilter__input--price').on('change', function () { if (!dFflag) set(); var filter = $(this).closest('.tfilter'); if (filter.hasClass('tfilter--disabled')) return; filter.data('param', $(this).data('val')); addTagging(); }); // change feature param $popEl.find('.tfilter__input--feature').on('change', function () { if (!dFflag) dFflag = true; var filter = $(this).closest('.tfilter'); if (filter.hasClass('tfilter--disabled')) return; featureString = ''; $popEl.find('.tfilter__input--feature').each(function (_i, _v) { if ($(_v).is(':checked')) { featureString += (featureString.length > 0 ? '+' : '') + $(_v).data('val'); } }); filter.data('param', featureString); addTagging(); }); $popEl.find('.cbox__input').on('change', function () { addTagging(); }); } }; })(); function getQueryString() { var key = false, res = {}, itm = null; var qs = location.search.substring(1); if (arguments.length > 0 && arguments[0].length > 1) { key = arguments[0]; } var pattern = /([^&=]+)=([^&]*)/g; while ((itm = pattern.exec(qs))) { if (key !== false && decodeURIComponent(itm[1]) === key) return decodeURIComponent(itm[2]); else if (key === false) res[decodeURIComponent(itm[1])] = decodeURIComponent(itm[2]); } return key === false ? res : null; } // function setMoHeight() { // var $curPopEl = $(".l-popup--active"); // var $rowEl = $curPopEl.find(".cui__row"); // $rowEl.css({ // minHeight: ($curPopEl.find(".l-popup__window-content").outerHeight() - ($curPopEl.find(".l-popup__pad").outerHeight() - $curPopEl.find(".l-popup__inner").outerHeight())) + "px" // }); // if ($rowEl.outerHeight() - $curPopEl.find(".finder-scr").outerHeight() < $rowEl.find(".cui__row-box").outerHeight()) { // $curPopEl.find(".finder-scr").addClass("finder-scr--hidden"); // } else { // $curPopEl.find(".finder-scr").removeClass("finder-scr--hidden"); // } // }; // find out now (banner button animation) // var bnnBtnAni = function() { // var scrPos = $(window).scrollTop(); // var winHeight = $(window).height(); // var $bnnBtn = $(".finder-bnn__btn"); // var bnnBtnHeight = $bnnBtn.height(); // $bnnBtn.each(function() { // var bnnBtnPos = $(this).offset().top; // if(scrPos > (bnnBtnPos - winHeight - bnnBtnHeight)) { // $(this).addClass("finder-bnn__btn--active"); // } // }); // }; // URL Prameter proc var finderMoChk = null; $(document).ready(function () { var c1 = getQueryString('pop1'); var c2 = getQueryString('pop2'); $('.l-popup').each(function () { $('body').append($(this)); }); if (c1 == 'on') { fdHisotryState(); fdReadyToBack = false; popup.open(1); } else if (c2 == 'on') { fdHisotryState(); fdReadyToBack = false; popup.open(2); } // bnnBtnAni(); }); var timerFunc = function (_f, _delta) { var fdTimer = null; clearTimeout(fdTimer); fdTimer = setTimeout(function () { _f(); }, _delta || 400); }; // $(window).resize(function() { // // mobile check on resize // finderMoChk = window.innerWidth <= 767 ? true : false // timerFunc(function () { // if (finderMoChk) { // setMoHeight(); // } else { // $(".cui__row").removeAttr("style"); // } // bnnBtnAni(); // }); // }); // $(window).scroll(function() { // timerFunc(function() { // bnnBtnAni(); // }); // }); var $finderPopup = $('.l-popup--active'); $(document).on('keydown', $finderPopup, function (e) { var isShift = window.event.shiftKey ? true : false; var keyCode = e.keyCode || e.which; if (!isShift && keyCode === 9) { if ($(e.target).hasClass('l-popup__close-btn')) { e.preventDefault(); $finderPopupFirstEl.focus(); } } else if (isShift && keyCode === 9) { if ($finderPopupFirstEl !== null) { if ($finderPopupFirstEl.is(':focus')) { e.preventDefault(); isShift = false; $('.l-popup__close-btn').focus(); } } } });})(window.jQuery);});