BossBey File Manager
PHP:
8.2.30
OS:
Linux
User:
imagivibe
Root
/
home
/
imagivibe
/
www
/
wp-content
/
plugins
/
porto-functionality
/
shortcodes
/
assets
/
js
📤 Upload
📝 New File
📁 New Folder
Close
Editing: 360-degrees-product-viewer.min.js
(function(e){"use strict";e(document).ready((function(e){var t=function(e){this.element=e,this.handleContainer=this.element.find(".cd-product-viewer-handle"),this.handleFill=this.handleContainer.children(".fill"),this.handle=this.handleContainer.children(".handle"),this.imageWrapper=this.element.find(".product-viewer"),this.slideShow=this.imageWrapper.children(".product-sprite"),this.frames=this.element.data("frame"),this.friction=this.element.data("friction"),this.visibleFrame=0,this.loaded=!1,this.animating=!1,this.xPosition=0,this.loadFrames()};function n(e,t){e.css({"-moz-transform":t,"-webkit-transform":t,"-ms-transform":t,"-o-transform":t,transform:t}),e.prev().css({visibility:"hidden"})}t.prototype.loadFrames=function(){var t=this,n=this.slideShow.data("image"),i=e("<img/>");this.loading("0.5"),i.attr("src",n).load(n,(function(){e(this).remove(),t.loaded=!0})).each((function(){this.complete&&e(this).trigger("load")}))},t.prototype.loading=function(e){var t=this;n(this.handleFill,"scaleX("+e+")"),setTimeout((function(){if(t.loaded)t.element.addClass("loaded"),n(t.handleFill,"scaleX(1)"),t.dragImage(),t.handle&&t.dragHandle();else{var i=parseFloat(e)+.1;i<1?t.loading(i):t.loading(parseFloat(e))}}),500)},t.prototype.dragHandle=function(){var t=this;t.handle.on("mousedown touchstart",(function(n){t.handle.addClass("cd-draggable");var i=t.handle.outerWidth(),a=t.handleContainer.offset().left,o=t.handleContainer.outerWidth(),r=a-i/2,s=a+o-i/2;t.xPosition=t.handle.offset().left+i-(e(window).width()<992&&n.originalEvent.touches?n.originalEvent.touches[0].pageX:n.pageX),t.element.on("mousemove touchmove",(function(e){t.animating||(t.animating=!0,window.requestAnimationFrame?requestAnimationFrame((function(){t.animateDraggedHandle(e,i,a,o,r,s)})):setTimeout((function(){t.animateDraggedHandle(e,i,a,o,r,s)}),100))})).one("mouseup touchend",(function(e){t.handle.removeClass("cd-draggable"),t.element.off("mousemove touchmove")})),n.preventDefault()})).on("mouseup touchend",(function(e){t.handle.removeClass("cd-draggable")}))},t.prototype.animateDraggedHandle=function(t,n,i,a,o,r){var s=this,d=(e(window).width()<992&&t.originalEvent.touches?t.originalEvent.touches[0].pageX:t.pageX)+s.xPosition-n;d<o?d=o:d>r&&(d=r);var l=Math.ceil(1e3*(d+n/2-i)/a)/10;s.visibleFrame=Math.ceil(l*(s.frames-1)/100),s.updateFrame(),e(".cd-draggable",s.handleContainer).css("left",l+"%").one("mouseup touchend",(function(){e(this).removeClass("cd-draggable")})),s.animating=!1},t.prototype.dragImage=function(){var t=this;t.slideShow.on("mousedown touchstart",(function(n){t.slideShow.addClass("cd-draggable");var i=t.imageWrapper.offset().left,a=t.imageWrapper.outerWidth();t.frames;t.xPosition=e(window).width()<992?n.originalEvent.touches[0].pageX:n.pageX,t.element.on("mousemove touchmove",(function(e){t.animating||(t.animating=!0,window.requestAnimationFrame?requestAnimationFrame((function(){t.animateDraggedImage(e,i,a)})):setTimeout((function(){t.animateDraggedImage(e,i,a)}),100))})).one("mouseup touchend",(function(e){t.slideShow.removeClass("cd-draggable"),t.element.off("mousemove touchmove"),t.updateHandle()})),n.preventDefault()})).on("mouseup touchend",(function(e){t.slideShow.removeClass("cd-draggable")}))},t.prototype.animateDraggedImage=function(t,n,i){var a=this,o=a.xPosition-(e(window).width()<992?t.originalEvent.touches[0].pageX:t.pageX),r=Math.ceil(100*o/(i*a.friction))*(a.frames-1)/100;r=r>0?Math.floor(r):Math.ceil(r);var s=a.visibleFrame+r;s<0?s=a.frames-1:s>a.frames-1&&(s=0),s!=a.visibleFrame&&(a.visibleFrame=s,a.updateFrame(),a.xPosition=e(window).width()<992?t.originalEvent.touches[0].pageX:t.pageX),a.animating=!1},t.prototype.updateHandle=function(){if(this.handle){var e=100*this.visibleFrame/this.frames;this.handle.animate({left:e+"%"},200)}},t.prototype.updateFrame=function(){var e=-100*this.visibleFrame/this.frames;n(this.slideShow,"translateX("+e+"%)")},e(".cd-product-viewer-wrapper").each((function(){new t(e(this))})),window.parent.vc&&window.parent.vc.events?window.parent.vc.events.on("shortcodeView:ready",(function(n){n.view.$el&&("porto_360degree_image_viewer"==n.attributes.shortcode&&n.view.$el.find(".cd-product-viewer-wrapper").each((function(){e(this).hasClass("fe-init")||(new t(e(this)),e(this).addClass("fe-init"))})))})):"undefined"!=typeof elementorFrontend&&elementorFrontend.on("components:init",(function(){elementorFrontend.hooks.addAction("frontend/element_ready/porto_360_degree_image_viewer.default",(function(n){n.find(".cd-product-viewer-wrapper").each((function(){new t(e(this))}))}))}))}))}).apply(this,[jQuery]);
Save
Cancel