Creating a Culture of Safety
ASHRM On-Demand Webinar
Member: $39.00Non-Member: $99.00
ASHRM CE Credit: 1.0
Level: Practitioner
Access Now
This educational session will provide participants with the opportunity to learn how to measure an organization’s culture of safety coupled with practices to implement “Just Culture”.
Creating a safe and transparent environment that encourages reporting of mistakes improves the care provided to patients, however implementing a “Just Culture” is not an easy task and doesn’t happen overnight. This educational session will provide participants with the opportunity to learn how to measure an organization’s culture of safety coupled with practices to implement “Just Culture”.
Objectives:
• Identify methods to implement and measure organizational culture
• Distinguish how just culture algorithms can be used to analyze events and individual accountability
• Recognize and manage the different types of behaviors in a just culture
Speakers: Dr. Jennifer Kozaily
Product Code
322025OD22
ASHRM CE Credits
1.0
CNE Credits
1.0
Domain
N/A
Level - Foundational (F), Practitioner (P), Advanced (A)
P
Publication Date
1/15/23
Next Review
7/1/23
Credit Expires
7/1/24
For questions regarding this webinar, contact ASHRMEd@aha.org
Speaker Bios
Dr. Jennifer Kozaily has been overseeing quality, patient safety, accreditation and risk management programs at different leadership levels. Dr. Kozaily received her Doctor of Pharmacy from the Lebanese American University (LAU), Lebanon. She then completed a PGY-1 Pharmacy Residency at Florida Hospital in Orlando, FL, USA and then worked as the Emergency Medicine Pharmacist and the Medication Safety Officer at Florida Hospital, she received the Adventist Health System Pharmacy Quality Award for the implementation of pharmacy services in Emergency Department. Dr. Kozaily is a Certified Professional in Health Care Risk Management (CPHRM)and Patient Safety (CPPS), and she has received her Master of Laws (LLM) in Medical Law & Ethics at the University of Edinburgh in 2021. She is an active member of the American Society for Healthcare Risk Management (ASHRM).
',d=k.lazyLoad?'
':'
',b.after(d),b.after(e)};if(b.wrap('
"),this._core.settings.lazyLoad&&(i="data-src",j="owl-lazy"),h.length)return l(h.attr(i)),h.remove(),!1;"youtube"===c.type?(f="//img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type?a.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}):"vzaar"===c.type&&a.ajax({type:"GET",url:"//vzaar.com/api/videos/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a.framegrab_url,l(f)}})},e.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},e.prototype.play=function(b){var c,d=a(b.target),e=d.closest("."+this._core.settings.itemClass),f=this._videos[e.attr("data-video")],g=f.width||"100%",h=f.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),e=this._core.items(this._core.relative(e.index())),this._core.reset(e.index()),"youtube"===f.type?c='
':"vimeo"===f.type?c='
':"vzaar"===f.type&&(c='
'),a('
'+c+"
").insertAfter(e.find(".owl-video")),this._playing=e.addClass("owl-video-playing"))},e.prototype.isInFullScreen=function(){var b=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return b&&a(b).parent().hasClass("owl-video-frame")},e.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){a.namespace&&(this.swapping="translated"==a.type)},this),"translate.owl.carousel":a.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&a.support.animation&&a.support.transition){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.one(a.support.animation.end,c).css({left:b+"px"}).addClass("animated owl-animated-out").addClass(g)),f&&e.one(a.support.animation.end,c).addClass("animated owl-animated-in").addClass(f))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},
a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._timeout=null,this._paused=!1,this._handlers={"changed.owl.carousel":a.proxy(function(a){a.namespace&&"settings"===a.property.name?this._core.settings.autoplay?this.play():this.stop():a.namespace&&"position"===a.property.name&&this._core.settings.autoplay&&this._setAutoPlayInterval()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":a.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(a){a.namespace&&this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=a.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype.play=function(a,b){this._paused=!1,this._core.is("rotating")||(this._core.enter("rotating"),this._setAutoPlayInterval())},e.prototype._getNextTimeout=function(d,e){return this._timeout&&b.clearTimeout(this._timeout),b.setTimeout(a.proxy(function(){this._paused||this._core.is("busy")||this._core.is("interacting")||c.hidden||this._core.next(e||this._core.settings.autoplaySpeed)},this),d||this._core.settings.autoplayTimeout)},e.prototype._setAutoPlayInterval=function(){this._timeout=this._getNextTimeout()},e.prototype.stop=function(){this._core.is("rotating")&&(b.clearTimeout(this._timeout),this._core.leave("rotating"))},e.prototype.pause=function(){this._core.is("rotating")&&(this._paused=!0)},e.prototype.destroy=function(){var a,b;this.stop();for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){b.namespace&&this._core.settings.dotsData&&this._templates.push('
'+a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"
")},this),"added.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),"remove.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&this.draw()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var b,c=this._core.settings;this._controls.$relative=(c.navContainer?a(c.navContainer):a("
").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=a("").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click",a.proxy(function(a){this.prev(c.navSpeed)},this)),this._controls.$next=a("").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click",a.proxy(function(a){this.next(c.navSpeed)},this)),c.dotsData||(this._templates=[a("
").addClass(c.dotClass).append(a("
")).prop("outerHTML")]),this._controls.$absolute=(c.dotsContainer?a(c.dotsContainer):a("").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","div",a.proxy(function(b){var d=a(b.target).parent().is(this._controls.$absolute)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(d,c.dotsSpeed)},this));for(b in this._overrides)this._core[b]=a.proxy(this[b],this)},e.prototype.destroy=function(){var a,b,c,d;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},e.prototype.update=function(){var a,b,c,d=this._core.clones().length/2,e=d+this._core.items().length,f=this._core.maximum(!0),g=this._core.settings,h=g.center||g.autoWidth||g.dotsData?1:g.dotsEach||g.items;if("page"!==g.slideBy&&(g.slideBy=Math.min(g.slideBy,g.items)),g.dots||"page"==g.slideBy)for(this._pages=[],a=d,b=0,c=0;a
=h||0===b){if(this._pages.push({start:Math.min(f,a-d),end:a-d+h-1}),Math.min(f,a-d)===f)break;b=0,++c}b+=this._core.mergers(this._core.relative(a))}},e.prototype.draw=function(){var b,c=this._core.settings,d=this._core.items().length=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!c.dots||d),c.dots&&(b=this._pages.length-this._controls.$absolute.children().length,c.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join("")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):b=b},this)).pop()},e.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},e.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},e.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},e.prototype.to=function(b,c,d){var e;!d&&this._pages.length?(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c)):a.proxy(this._overrides.to,this._core)(b,c)},a.fn.owlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":a.proxy(function(c){c.namespace&&"URLHash"===this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!c)return;this._hashes[c]=b.content}},this),"changed.owl.carousel":a.proxy(function(c){if(c.namespace&&"position"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),e=a.map(this._hashes,function(a,b){return a===d?b:null}).join();if(!e||b.location.hash.slice(1)===e)return;b.location.hash=e}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(a){var c=b.location.hash.substring(1),e=this._core.$stage.children(),f=this._hashes[c]&&e.index(this._hashes[c]);f!==d&&f!==this._core.current()&&this._core.to(this._core.relative(f),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){function e(b,c){var e=!1,f=b.charAt(0).toUpperCase()+b.slice(1);return a.each((b+" "+h.join(f+" ")+f).split(" "),function(a,b){if(g[b]!==d)return e=!c||b,!1}),e}function f(a){return e(a,!0)}var g=a("").get(0).style,h="Webkit Moz O ms".split(" "),i={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},j={csstransforms:function(){return!!e("transform")},csstransforms3d:function(){return!!e("perspective")},csstransitions:function(){return!!e("transition")},cssanimations:function(){return!!e("animation")}};j.csstransitions()&&(a.support.transition=new String(f("transition")),a.support.transition.end=i.transition.end[a.support.transition]),j.cssanimations()&&(a.support.animation=new String(f("animation")),a.support.animation.end=i.animation.end[a.support.animation]),j.csstransforms()&&(a.support.transform=new String(f("transform")),a.support.transform3d=j.csstransforms3d())}(window.Zepto||window.jQuery,window,document);
/*
* jQuery elevateZoom 3.0.8
* Demo's and documentation:
* www.elevateweb.co.uk/image-zoom
*
* Copyright (c) 2012 Andrew Eades
* www.elevateweb.co.uk
*
* Dual licensed under the GPL and MIT licenses.
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
/*
* jQuery elevateZoom 3.0.3
* Demo's and documentation:
* www.elevateweb.co.uk/image-zoom
*
* Copyright (c) 2012 Andrew Eades
* www.elevateweb.co.uk
*
* Dual licensed under the GPL and MIT licenses.
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*/
if ( typeof Object.create !== 'function' ) {
Object.create = function( obj ) {
function F() {};
F.prototype = obj;
return new F();
};
}
(function( $, window, document, undefined ) {
var ElevateZoom = {
init: function( options, elem ) {
var self = this;
self.elem = elem;
self.$elem = $( elem );
self.imageSrc = self.$elem.data("zoom-image") ? self.$elem.data("zoom-image") : self.$elem.attr("src");
self.options = $.extend( {}, $.fn.elevateZoom.options, options );
//TINT OVERRIDE SETTINGS
if(self.options.tint) {
self.options.lensColour = "none", //colour of the lens background
self.options.lensOpacity = "1" //opacity of the lens
}
//INNER OVERRIDE SETTINGS
if(self.options.zoomType == "inner") {self.options.showLens = false;}
//Remove alt on hover
self.$elem.parent().removeAttr('title').removeAttr('alt');
self.zoomImage = self.imageSrc;
self.refresh( 1 );
//Create the image swap from the gallery
$('#'+self.options.gallery + ' a').click( function(e) {
//Set a class on the currently active gallery image
if(self.options.galleryActiveClass){
$('#'+self.options.gallery + ' a').removeClass(self.options.galleryActiveClass);
$(this).addClass(self.options.galleryActiveClass);
}
//stop any link on the a tag from working
e.preventDefault();
//call the swap image function
if($(this).data("zoom-image")){self.zoomImagePre = $(this).data("zoom-image")}
else{self.zoomImagePre = $(this).data("image");}
self.swaptheimage($(this).data("image"), self.zoomImagePre);
return false;
});
},
refresh: function( length ) {
var self = this;
setTimeout(function() {
self.fetch(self.imageSrc);
}, length || self.options.refresh );
},
fetch: function(imgsrc) {
//get the image
var self = this;
var newImg = new Image();
newImg.onload = function() {
//set the large image dimensions - used to calculte ratio's
self.largeWidth = newImg.width;
self.largeHeight = newImg.height;
//once image is loaded start the calls
self.startZoom();
self.currentImage = self.imageSrc;
//let caller know image has been loaded
self.options.onZoomedImageLoaded(self.$elem);
}
newImg.src = imgsrc; // this must be done AFTER setting onload
return;
},
startZoom: function( ) {
var self = this;
//get dimensions of the non zoomed image
self.nzWidth = self.$elem.width();
self.nzHeight = self.$elem.height();
//activated elements
self.isWindowActive = false;
self.isLensActive = false;
self.isTintActive = false;
self.overWindow = false;
//CrossFade Wrappe
if(self.options.imageCrossfade){
self.zoomWrap = self.$elem.wrap('
');
self.$elem.css('position', 'absolute');
}
self.zoomLock = 1;
self.scrollingLock = false;
self.changeBgSize = false;
self.currentZoomLevel = self.options.zoomLevel;
//get offset of the non zoomed image
self.nzOffset = self.$elem.offset();
//calculate the width ratio of the large/small image
self.widthRatio = (self.largeWidth/self.currentZoomLevel) / self.nzWidth;
self.heightRatio = (self.largeHeight/self.currentZoomLevel) / self.nzHeight;
//if window zoom
if(self.options.zoomType == "window") {
self.zoomWindowStyle = "overflow: hidden;"
+ "background-position: 0px 0px;text-align:center;"
+ "background-color: " + String(self.options.zoomWindowBgColour)
+ ";width: " + String(self.options.zoomWindowWidth) + "px;"
+ "height: " + String(self.options.zoomWindowHeight)
+ "px;float: left;"
+ "background-size: "+ self.largeWidth/self.currentZoomLevel+ "px " +self.largeHeight/self.currentZoomLevel + "px;"
+ "display: none;z-index:100;"
+ "border: " + String(self.options.borderSize)
+ "px solid " + self.options.borderColour
+ ";background-repeat: no-repeat;"
+ "position: absolute;";
}
//if inner zoom
if(self.options.zoomType == "inner") {
//has a border been put on the image? Lets cater for this
var borderWidth = self.$elem.css("border-left-width");
self.zoomWindowStyle = "overflow: hidden;"
+ "margin-left: " + String(borderWidth) + ";"
+ "margin-top: " + String(borderWidth) + ";"
+ "background-position: 0px 0px;"
+ "width: " + String(self.nzWidth) + "px;"
+ "height: " + String(self.nzHeight) + "px;"
+ "px;float: left;"
+ "display: none;"
+ "cursor:"+(self.options.cursor)+";"
+ "px solid " + self.options.borderColour
+ ";background-repeat: no-repeat;"
+ "position: absolute;";
}
//lens style for window zoom
if(self.options.zoomType == "window") {
// adjust images less than the window height
if(self.nzHeight ').addClass('zoomContainer').css({"position":"relative", "height":self.nzHeight, "width":self.nzWidth});
self.zoomContainer = $('
');
$('body').append(self.zoomContainer);
//this will add overflow hidden and contrain the lens on lens mode
if(self.options.containLensZoom && self.options.zoomType == "lens"){
self.zoomContainer.css("overflow", "hidden");
}
if(self.options.zoomType != "inner") {
self.zoomLens = $("
")
.appendTo(self.zoomContainer)
.click(function () {
self.$elem.trigger('click');
});
if(self.options.tint) {
self.tintContainer = $('
').addClass('tintContainer');
self.zoomTint = $("
");
self.zoomLens.wrap(self.tintContainer);
self.zoomTintcss = self.zoomLens.after(self.zoomTint);
//if tint enabled - set an image to show over the tint
self.zoomTintImage = $(' ')
.appendTo(self.zoomLens)
.click(function () {
self.$elem.trigger('click');
});
}
}
//create zoom window
if(isNaN(self.options.zoomWindowPosition)){
self.zoomWindow = $("
")
.appendTo('body')
.click(function () {
self.$elem.trigger('click');
});
}else{
self.zoomWindow = $("
")
.appendTo(self.zoomContainer)
.click(function () {
self.$elem.trigger('click');
});
}
self.zoomWindowContainer = $('
').addClass('zoomWindowContainer').css("width",self.options.zoomWindowWidth);
self.zoomWindow.wrap(self.zoomWindowContainer);
// self.captionStyle = "text-align: left;background-color: black;color: white;font-weight: bold;padding: 10px;font-family: sans-serif;font-size: 11px";
// self.zoomCaption = $('INSERT ALT TAG
').appendTo(self.zoomWindow.parent());
if(self.options.zoomType == "lens") {
self.zoomLens.css({ backgroundImage: "url('" + self.imageSrc + "')" });
}
if(self.options.zoomType == "window") {
self.zoomWindow.css({ backgroundImage: "url('" + self.imageSrc + "')" });
}
if(self.options.zoomType == "inner") {
self.zoomWindow.css({ backgroundImage: "url('" + self.imageSrc + "')" });
}
/*-------------------END THE ZOOM WINDOW AND LENS----------------------------------*/
//touch events
self.$elem.bind('touchmove', function(e){
e.preventDefault();
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
self.setPosition(touch);
});
self.zoomContainer.bind('touchmove', function(e){
if(self.options.zoomType == "inner") {
self.showHideWindow("show");
}
e.preventDefault();
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
self.setPosition(touch);
});
self.zoomContainer.bind('touchend', function(e){
self.showHideWindow("hide");
if(self.options.showLens) {self.showHideLens("hide");}
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
});
self.$elem.bind('touchend', function(e){
self.showHideWindow("hide");
if(self.options.showLens) {self.showHideLens("hide");}
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
});
if(self.options.showLens) {
self.zoomLens.bind('touchmove', function(e){
e.preventDefault();
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
self.setPosition(touch);
});
self.zoomLens.bind('touchend', function(e){
self.showHideWindow("hide");
if(self.options.showLens) {self.showHideLens("hide");}
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
});
}
//Needed to work in IE
self.$elem.bind('mousemove', function(e){
if(self.overWindow == false){self.setElements("show");}
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
self.zoomContainer.bind('mousemove', function(e){
if(self.overWindow == false){self.setElements("show");}
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
if(self.options.zoomType != "inner") {
self.zoomLens.bind('mousemove', function(e){
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
}
if(self.options.tint && self.options.zoomType != "inner") {
self.zoomTint.bind('mousemove', function(e){
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
}
if(self.options.zoomType == "inner") {
self.zoomWindow.bind('mousemove', function(e) {
//self.overWindow = true;
//make sure on orientation change the setposition is not fired
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
self.setPosition(e);
self.currentLoc = e;
}
self.lastX = e.clientX;
self.lastY = e.clientY;
});
}
// lensFadeOut: 500, zoomTintFadeIn
self.zoomContainer.add(self.$elem).mouseenter(function(){
if(self.overWindow == false){self.setElements("show");}
}).mouseleave(function(){
if(!self.scrollLock){
self.setElements("hide");
self.options.onDestroy(self.$elem);
}
});
//end ove image
if(self.options.zoomType != "inner") {
self.zoomWindow.mouseenter(function(){
self.overWindow = true;
self.setElements("hide");
}).mouseleave(function(){
self.overWindow = false;
});
}
//end ove image
// var delta = parseInt(e.originalEvent.wheelDelta || -e.originalEvent.detail);
// $(this).empty();
// return false;
//fix for initial zoom setting
if (self.options.zoomLevel != 1){
// self.changeZoomLevel(self.currentZoomLevel);
}
//set the min zoomlevel
if(self.options.minZoomLevel){
self.minZoomLevel = self.options.minZoomLevel;
}
else{
self.minZoomLevel = self.options.scrollZoomIncrement * 2;
}
if(self.options.scrollZoom){
self.zoomContainer.add(self.$elem).bind('mousewheel DOMMouseScroll MozMousePixelScroll', function(e){
// in IE there is issue with firing of mouseleave - So check whether still scrolling
// and on mouseleave check if scrolllock
self.scrollLock = true;
clearTimeout($.data(this, 'timer'));
$.data(this, 'timer', setTimeout(function() {
self.scrollLock = false;
//do something
}, 250));
var theEvent = e.originalEvent.wheelDelta || e.originalEvent.detail*-1
//this.scrollTop += ( delta 0) {
//scrolling up
if(self.currentZoomLevel >= self.minZoomLevel){
self.changeZoomLevel(self.currentZoomLevel-self.options.scrollZoomIncrement);
}
}
else{
//scrolling down
if(self.options.maxZoomLevel){
if(self.currentZoomLevel self.nzHeight - (self.zoomLens.height()/2)-(self.options.lensBorderSize*2));
self.Eloppos = (self.mouseLeft (self.nzWidth - (self.zoomLens.width()/2)-(self.options.lensBorderSize*2)));
}
//calculate the bound regions - but only for inner zoom
if(self.options.zoomType == "inner"){
self.Etoppos = (self.mouseTop (self.nzHeight - ((self.nzHeight/2)/self.heightRatio)));
self.Eloppos = (self.mouseLeft (self.nzWidth - (self.nzWidth/2)/self.widthRatio-(self.options.lensBorderSize*2)));
}
// if the mouse position of the slider is one of the outerbounds, then hide window and lens
if (self.mouseLeft self.nzWidth || self.mouseTop > self.nzHeight ) {
self.setElements("hide");
return;
}
//else continue with operations
else {
//lens options
if(self.options.showLens) {
// self.showHideLens("show");
//set background position of lens
self.lensLeftPos = String(Math.floor(self.mouseLeft - self.zoomLens.width() / 2));
self.lensTopPos = String(Math.floor(self.mouseTop - self.zoomLens.height() / 2));
}
//adjust the background position if the mouse is in one of the outer regions
//Top region
if(self.Etoppos){
self.lensTopPos = 0;
}
//Left Region
if(self.Eloppos){
self.windowLeftPos = 0;
self.lensLeftPos = 0;
self.tintpos=0;
}
//Set bottom and right region for window mode
if(self.options.zoomType == "window") {
if(self.Eboppos){
self.lensTopPos = Math.max( (self.nzHeight)-self.zoomLens.height()-(self.options.lensBorderSize*2), 0 );
}
if(self.Eroppos){
self.lensLeftPos = (self.nzWidth-(self.zoomLens.width())-(self.options.lensBorderSize*2));
}
}
//Set bottom and right region for inner mode
if(self.options.zoomType == "inner") {
if(self.Eboppos){
self.lensTopPos = Math.max( ((self.nzHeight)-(self.options.lensBorderSize*2)), 0 );
}
if(self.Eroppos){
self.lensLeftPos = (self.nzWidth-(self.nzWidth)-(self.options.lensBorderSize*2));
}
}
//if lens zoom
if(self.options.zoomType == "lens") {
self.windowLeftPos = String(((e.pageX - self.nzOffset.left) * self.widthRatio - self.zoomLens.width() / 2) * (-1));
self.windowTopPos = String(((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomLens.height() / 2) * (-1));
self.zoomLens.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
if(self.changeBgSize){
if(self.nzHeight>self.nzWidth){
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
else{
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
self.changeBgSize = false;
}
self.setWindowPostition(e);
}
//if tint zoom
if(self.options.tint && self.options.zoomType != "inner") {
self.setTintPosition(e);
}
//set the css background position
if(self.options.zoomType == "window") {
self.setWindowPostition(e);
}
if(self.options.zoomType == "inner") {
self.setWindowPostition(e);
}
if(self.options.showLens) {
if(self.fullwidth && self.options.zoomType != "lens"){
self.lensLeftPos = 0;
}
self.zoomLens.css({ left: self.lensLeftPos + 'px', top: self.lensTopPos + 'px' })
}
} //end else
},
showHideWindow: function(change) {
var self = this;
if(change == "show"){
if(!self.isWindowActive){
if(self.options.zoomWindowFadeIn){
self.zoomWindow.stop(true, true, false).fadeIn(self.options.zoomWindowFadeIn);
}
else{self.zoomWindow.show();}
self.isWindowActive = true;
}
}
if(change == "hide"){
if(self.isWindowActive){
if(self.options.zoomWindowFadeOut){
self.zoomWindow.stop(true, true).fadeOut(self.options.zoomWindowFadeOut, function () {
if (self.loop) {
//stop moving the zoom window when zoom window is faded out
clearInterval(self.loop);
self.loop = false;
}
});
}
else{self.zoomWindow.hide();}
self.isWindowActive = false;
}
}
},
showHideLens: function(change) {
var self = this;
if(change == "show"){
if(!self.isLensActive){
if(self.options.lensFadeIn){
self.zoomLens.stop(true, true, false).fadeIn(self.options.lensFadeIn);
}
else{self.zoomLens.show();}
self.isLensActive = true;
}
}
if(change == "hide"){
if(self.isLensActive){
if(self.options.lensFadeOut){
self.zoomLens.stop(true, true).fadeOut(self.options.lensFadeOut);
}
else{self.zoomLens.hide();}
self.isLensActive = false;
}
}
},
showHideTint: function(change) {
var self = this;
if(change == "show"){
if(!self.isTintActive){
if(self.options.zoomTintFadeIn){
self.zoomTint.css({opacity:self.options.tintOpacity}).animate().stop(true, true).fadeIn("slow");
}
else{
self.zoomTint.css({opacity:self.options.tintOpacity}).animate();
self.zoomTint.show();
}
self.isTintActive = true;
}
}
if(change == "hide"){
if(self.isTintActive){
if(self.options.zoomTintFadeOut){
self.zoomTint.stop(true, true).fadeOut(self.options.zoomTintFadeOut);
}
else{self.zoomTint.hide();}
self.isTintActive = false;
}
}
},
setLensPostition: function( e ) {
},
setWindowPostition: function( e ) {
//return obj.slice( 0, count );
var self = this;
if(!isNaN(self.options.zoomWindowPosition)){
switch (self.options.zoomWindowPosition) {
case 1: //done
self.windowOffsetTop = (self.options.zoomWindowOffety);//DONE - 1
self.windowOffsetLeft =(+self.nzWidth); //DONE 1, 2, 3, 4, 16
break;
case 2:
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
self.windowOffsetTop = ((self.options.zoomWindowHeight/2)-(self.nzHeight/2))*(-1);
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
}
else{ //negative margin
}
break;
case 3: //done
self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize*2)); //DONE 3,9
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
break;
case 4: //done
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
break;
case 5: //done
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft =(self.nzWidth-self.zoomWindow.width()-(self.options.borderSize*2)); //DONE - 5,15
break;
case 6:
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft =((self.options.zoomWindowWidth/2)-(self.nzWidth/2)+(self.options.borderSize*2))*(-1);
}
else{ //negative margin
}
break;
case 7: //done
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft = 0; //DONE 7, 13
break;
case 8: //done
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
break;
case 9: //done
self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize*2)); //DONE 3,9
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
break;
case 10:
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
self.windowOffsetTop = ((self.options.zoomWindowHeight/2)-(self.nzHeight/2))*(-1);
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
}
else{ //negative margin
}
break;
case 11:
self.windowOffsetTop = (self.options.zoomWindowOffety);
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
break;
case 12: //done
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
break;
case 13: //done
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =(0); //DONE 7, 13
break;
case 14:
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =((self.options.zoomWindowWidth/2)-(self.nzWidth/2)+(self.options.borderSize*2))*(-1);
}
else{ //negative margin
}
break;
case 15://done
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =(self.nzWidth-self.zoomWindow.width()-(self.options.borderSize*2)); //DONE - 5,15
break;
case 16: //done
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
break;
default: //done
self.windowOffsetTop = (self.options.zoomWindowOffety);//DONE - 1
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
}
} //end isNAN
else{
//WE CAN POSITION IN A CLASS - ASSUME THAT ANY STRING PASSED IS
self.externalContainer = $('#'+self.options.zoomWindowPosition);
self.externalContainerWidth = self.externalContainer.width();
self.externalContainerHeight = self.externalContainer.height();
self.externalContainerOffset = self.externalContainer.offset();
self.windowOffsetTop = self.externalContainerOffset.top;//DONE - 1
self.windowOffsetLeft =self.externalContainerOffset.left; //DONE 1, 2, 3, 4, 16
}
self.isWindowSet = true;
self.windowOffsetTop = self.windowOffsetTop + self.options.zoomWindowOffety;
self.windowOffsetLeft = self.windowOffsetLeft + self.options.zoomWindowOffetx;
self.zoomWindow.css({ top: self.windowOffsetTop});
self.zoomWindow.css({ left: self.windowOffsetLeft});
if(self.options.zoomType == "inner") {
self.zoomWindow.css({ top: 0});
self.zoomWindow.css({ left: 0});
}
self.windowLeftPos = String(((e.pageX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * (-1));
self.windowTopPos = String(((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * (-1));
if(self.Etoppos){self.windowTopPos = 0;}
if(self.Eloppos){self.windowLeftPos = 0;}
if(self.Eboppos){self.windowTopPos = (self.largeHeight/self.currentZoomLevel-self.zoomWindow.height())*(-1); }
if(self.Eroppos){self.windowLeftPos = ((self.largeWidth/self.currentZoomLevel-self.zoomWindow.width())*(-1));}
//stops micro movements
if(self.fullheight){
self.windowTopPos = 0;
}
if(self.fullwidth){
self.windowLeftPos = 0;
}
//set the css background position
if(self.options.zoomType == "window" || self.options.zoomType == "inner") {
if(self.zoomLock == 1){
//overrides for images not zoomable
if(self.widthRatio self.nzWidth){
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
else{
if(self.options.zoomType != "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
/*
if(!self.bgxp){self.bgxp = self.largeWidth/self.newvalue;}
if(!self.bgyp){self.bgyp = self.largeHeight/self.newvalue ;}
if (!self.bgloop){
self.bgloop = setInterval(function(){
self.bgxp += (self.largeWidth/self.newvalue - self.bgxp) / self.options.easingAmount;
self.bgyp += (self.largeHeight/self.newvalue - self.bgyp) / self.options.easingAmount;
self.zoomWindow.css({ "background-size": self.bgxp + 'px ' + self.bgyp + 'px' });
}, 16);
}
*/
self.changeBgSize = false;
}
self.zoomWindow.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
self.scrollingLock = false;
self.loop = false;
}
else if (Math.round(Math.abs(self.xp - self.windowLeftPos) + Math.abs(self.yp - self.windowTopPos)) self.nzWidth){
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
else{
if(self.options.zoomType != "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
self.changeBgSize = false;
}
self.zoomWindow.css({ backgroundPosition: self.xp + 'px ' + self.yp + 'px' });
}
}, 16);
}
}
else{
if(self.changeBgSize){
if(self.nzHeight>self.nzWidth){
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
}
else{
if(self.options.zoomType == "lens"){
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
}
if((self.largeHeight/self.newvaluewidth) ');
self.$elem.after(self.spinner);
}
self.options.onImageSwap(self.$elem);
newImg.onload = function() {
self.largeWidth = newImg.width;
self.largeHeight = newImg.height;
self.zoomImage = largeimage;
self.zoomWindow.css({ "background-size": self.largeWidth + 'px ' + self.largeHeight + 'px' });
self.swapAction(smallimage, largeimage);
return;
}
newImg.src = largeimage; // this must be done AFTER setting onload
},
swapAction: function(smallimage, largeimage){
var self = this;
var newImg2 = new Image();
newImg2.onload = function() {
//re-calculate values
self.nzHeight = newImg2.height;
self.nzWidth = newImg2.width;
self.options.onImageSwapComplete(self.$elem);
self.doneCallback();
return;
}
newImg2.src = smallimage;
//reset the zoomlevel to that initially set in options
self.currentZoomLevel = self.options.zoomLevel;
self.options.maxZoomLevel = false;
//swaps the main image
//self.$elem.attr("src",smallimage);
//swaps the zoom image
if(self.options.zoomType == "lens") {
self.zoomLens.css({ backgroundImage: "url('" + largeimage + "')" });
}
if(self.options.zoomType == "window") {
self.zoomWindow.css({ backgroundImage: "url('" + largeimage + "')" });
}
if(self.options.zoomType == "inner") {
self.zoomWindow.css({ backgroundImage: "url('" + largeimage + "')" });
}
self.currentImage = largeimage;
if(self.options.imageCrossfade){
var oldImg = self.$elem;
var newImg = oldImg.clone();
self.$elem.attr("src",smallimage)
self.$elem.after(newImg);
newImg.stop(true).fadeOut(self.options.imageCrossfade, function() {
$(this).remove();
});
// if(self.options.zoomType == "inner"){
//remove any attributes on the cloned image so we can resize later
self.$elem.width("auto").removeAttr("width");
self.$elem.height("auto").removeAttr("height");
// }
oldImg.fadeIn(self.options.imageCrossfade);
if(self.options.tint && self.options.zoomType != "inner") {
var oldImgTint = self.zoomTintImage;
var newImgTint = oldImgTint.clone();
self.zoomTintImage.attr("src",largeimage)
self.zoomTintImage.after(newImgTint);
newImgTint.stop(true).fadeOut(self.options.imageCrossfade, function() {
$(this).remove();
});
oldImgTint.fadeIn(self.options.imageCrossfade);
//self.zoomTintImage.attr("width",elem.data("image"));
//resize the tint window
self.zoomTint.css({ height: self.$elem.height()});
self.zoomTint.css({ width: self.$elem.width()});
}
self.zoomContainer.css("height", self.$elem.height());
self.zoomContainer.css("width", self.$elem.width());
if(self.options.zoomType == "inner"){
if(!self.options.constrainType){
self.zoomWrap.parent().css("height", self.$elem.height());
self.zoomWrap.parent().css("width", self.$elem.width());
self.zoomWindow.css("height", self.$elem.height());
self.zoomWindow.css("width", self.$elem.width());
}
}
if(self.options.imageCrossfade){
self.zoomWrap.css("height", self.$elem.height());
self.zoomWrap.css("width", self.$elem.width());
}
}
else{
self.$elem.attr("src",smallimage);
if(self.options.tint) {
self.zoomTintImage.attr("src",largeimage);
//self.zoomTintImage.attr("width",elem.data("image"));
self.zoomTintImage.attr("height",self.$elem.height());
//self.zoomTintImage.attr('src') = elem.data("image");
self.zoomTintImage.css({ height: self.$elem.height()});
self.zoomTint.css({ height: self.$elem.height()});
}
self.zoomContainer.css("height", self.$elem.height());
self.zoomContainer.css("width", self.$elem.width());
if(self.options.imageCrossfade){
self.zoomWrap.css("height", self.$elem.height());
self.zoomWrap.css("width", self.$elem.width());
}
}
if(self.options.constrainType){
//This will contrain the image proportions
if(self.options.constrainType == "height"){
self.zoomContainer.css("height", self.options.constrainSize);
self.zoomContainer.css("width", "auto");
if(self.options.imageCrossfade){
self.zoomWrap.css("height", self.options.constrainSize);
self.zoomWrap.css("width", "auto");
self.constwidth = self.zoomWrap.width();
}
else{
self.$elem.css("height", self.options.constrainSize);
self.$elem.css("width", "auto");
self.constwidth = self.$elem.width();
}
if(self.options.zoomType == "inner"){
self.zoomWrap.parent().css("height", self.options.constrainSize);
self.zoomWrap.parent().css("width", self.constwidth);
self.zoomWindow.css("height", self.options.constrainSize);
self.zoomWindow.css("width", self.constwidth);
}
if(self.options.tint){
self.tintContainer.css("height", self.options.constrainSize);
self.tintContainer.css("width", self.constwidth);
self.zoomTint.css("height", self.options.constrainSize);
self.zoomTint.css("width", self.constwidth);
self.zoomTintImage.css("height", self.options.constrainSize);
self.zoomTintImage.css("width", self.constwidth);
}
}
if(self.options.constrainType == "width"){
self.zoomContainer.css("height", "auto");
self.zoomContainer.css("width", self.options.constrainSize);
if(self.options.imageCrossfade){
self.zoomWrap.css("height", "auto");
self.zoomWrap.css("width", self.options.constrainSize);
self.constheight = self.zoomWrap.height();
}
else{
self.$elem.css("height", "auto");
self.$elem.css("width", self.options.constrainSize);
self.constheight = self.$elem.height();
}
if(self.options.zoomType == "inner"){
self.zoomWrap.parent().css("height", self.constheight);
self.zoomWrap.parent().css("width", self.options.constrainSize);
self.zoomWindow.css("height", self.constheight);
self.zoomWindow.css("width", self.options.constrainSize);
}
if(self.options.tint){
self.tintContainer.css("height", self.constheight);
self.tintContainer.css("width", self.options.constrainSize);
self.zoomTint.css("height", self.constheight);
self.zoomTint.css("width", self.options.constrainSize);
self.zoomTintImage.css("height", self.constheight);
self.zoomTintImage.css("width", self.options.constrainSize);
}
}
}
},
doneCallback: function(){
var self = this;
if(self.options.loadingIcon){
self.spinner.hide();
}
self.nzOffset = self.$elem.offset();
self.nzWidth = self.$elem.width();
self.nzHeight = self.$elem.height();
// reset the zoomlevel back to default
self.currentZoomLevel = self.options.zoomLevel;
//ratio of the large to small image
self.widthRatio = self.largeWidth / self.nzWidth;
self.heightRatio = self.largeHeight / self.nzHeight;
//NEED TO ADD THE LENS SIZE FOR ROUND
// adjust images less than the window height
if(self.options.zoomType == "window") {
if(self.nzHeight maxheightnewvalue){
newvalue = maxheightnewvalue;
}
if(newvalue > maxwidthtnewvalue){
newvalue = maxwidthtnewvalue;
}
if(maxheightnewvalue maxheightnewvalue){
self.newvalueheight = maxheightnewvalue;
}else{
self.newvalueheight = newvalue;
}
self.fullheight = true;
}
else{
self.heightRatio = (self.largeHeight/newvalue) / self.nzHeight;
if(newvalue > maxheightnewvalue){
self.newvalueheight = maxheightnewvalue;
}else{
self.newvalueheight = newvalue;
}
self.fullheight = false;
}
if(maxwidthtnewvalue maxwidthtnewvalue){
self.newvaluewidth = maxwidthtnewvalue;
}else{
self.newvaluewidth = newvalue;
}
self.fullwidth = true;
}
else{
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
self.newvaluewidth = newvalue;
self.fullwidth = false;
}
} //end inner
scrcontinue = false;
if(self.options.zoomType == "inner"){
if(self.nzWidth >= self.nzHeight){
if( self.newvaluewidth self.nzWidth){
if( self.newvaluewidth self.newvalueheight) {
self.currentZoomLevel = self.newvaluewidth;
}
}
if(self.options.zoomType != "lens" && self.options.zoomType != "inner") {
self.changeBgSize = true;
self.zoomLens.css({width: String((self.options.zoomWindowWidth)/self.widthRatio) + 'px' })
}
if(self.options.zoomType == "lens" || self.options.zoomType == "inner") {
self.changeBgSize = true;
}
}
if(self.options.zoomType == "inner"){
self.changeBgSize = true;
if(self.nzWidth > self.nzHeight){
self.currentZoomLevel = self.newvaluewidth;
}
if(self.nzHeight > self.nzWidth){
self.currentZoomLevel = self.newvaluewidth;
}
}
} //under
//sets the boundry change, called in setWindowPos
self.setPosition(self.currentLoc);
//
},
closeAll: function(){
if(self.zoomWindow){self.zoomWindow.hide();}
if(self.zoomLens){self.zoomLens.hide();}
if(self.zoomTint){self.zoomTint.hide();}
},
changeState: function(value){
var self = this;
if(value == 'enable'){self.options.zoomEnabled = true;}
if(value == 'disable'){self.options.zoomEnabled = false;}
}
};
$.fn.elevateZoom = function( options ) {
return this.each(function() {
var elevate = Object.create( ElevateZoom );
elevate.init( options, this );
$.data( this, 'elevateZoom', elevate );
});
};
$.fn.elevateZoom.options = {
zoomActivation: "hover", // Can also be click (PLACEHOLDER FOR NEXT VERSION)
zoomEnabled: true, //false disables zoomwindow from showing
preloading: 1, //by default, load all the images, if 0, then only load images after activated (PLACEHOLDER FOR NEXT VERSION)
zoomLevel: 1, //default zoom level of image
scrollZoom: false, //allow zoom on mousewheel, true to activate
scrollZoomIncrement: 0.1, //steps of the scrollzoom
minZoomLevel: false,
maxZoomLevel: false,
easing: false,
easingAmount: 12,
lensSize: 200,
zoomWindowWidth: 400,
zoomWindowHeight: 400,
zoomWindowOffetx: 0,
zoomWindowOffety: 0,
zoomWindowPosition: 1,
zoomWindowBgColour: "#fff",
lensFadeIn: false,
lensFadeOut: false,
debug: false,
zoomWindowFadeIn: false,
zoomWindowFadeOut: false,
zoomWindowAlwaysShow: false,
zoomTintFadeIn: false,
zoomTintFadeOut: false,
borderSize: 4,
showLens: true,
borderColour: "#888",
lensBorderSize: 1,
lensBorderColour: "#000",
lensShape: "square", //can be "round"
zoomType: "window", //window is default, also "lens" available -
containLensZoom: false,
lensColour: "white", //colour of the lens background
lensOpacity: 0.4, //opacity of the lens
lenszoom: false,
tint: false, //enable the tinting
tintColour: "#333", //default tint color, can be anything, red, #ccc, rgb(0,0,0)
tintOpacity: 0.4, //opacity of the tint
gallery: false,
galleryActiveClass: "zoomGalleryActive",
imageCrossfade: false,
constrainType: false, //width or height
constrainSize: false, //in pixels the dimensions you want to constrain on
loadingIcon: false, //http://www.example.com/spinner.gif
cursor:"default", // user should set to what they want the cursor as, if they have set a click function
responsive:true,
onComplete: $.noop,
onDestroy: function() {},
onZoomedImageLoaded: function() {},
onImageSwap: $.noop,
onImageSwapComplete: $.noop
};
})( jQuery, window, document );
(function ($) {
"use strict";
/*---slider activation---*/
var $slider = $('.slider_area');
if($slider.length > 0){
$slider.owlCarousel({
animateOut: 'fadeOut',
loop: true,
nav: false,
autoplay: false,
autoplayTimeout: 8000,
items: 1,
dots:true,
});
}
/*---product column5 activation---*/
var $porductColumn5 = $('.product_column5');
if($porductColumn5.length > 0){
$porductColumn5.on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 5,
margin: 20,
dots:false,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
576:{
items:2,
},
768:{
items:3,
},
992:{
items:4,
},
1200:{
items:5,
},
}
});
}
/*---product column4 activation---*/
var $productColumn4 = $('.product_column4');
if($productColumn4.length > 0){
$productColumn4.on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 4,
margin:20,
dots:false,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
576:{
items:2,
},
768:{
items:2,
},
992:{
items:4,
},
}
});
}
/*---productpage column4 activation---*/
var $productPageColumn4 = $('.productpage_column4');
if($productPageColumn4.length > 0){
$productPageColumn4.on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 4,
margin:20,
dots:false,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
576:{
items:2,
},
768:{
items:3,
},
992:{
items:4,
},
}
});
}
/*---product column3 activation---*/
var $productColumn3 = $('.product_column3');
if($productColumn3.length > 0){
$productColumn3.on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 3,
dots:false,
margin: 20,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
768:{
items:2,
},
992:{
items:3,
},
}
});
}
/*---product3 column3 activation---*/
var $product3Column3 = $('.product3_column3');
if($product3Column3.length > 0){
$product3Column3.on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 3,
dots:false,
margin: 20,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
576:{
items:2,
},
768:{
items:2,
},
992:{
items:3,
},
}
});
}
/*---product column2 activation---*/
var $productColumn2 = $('.product_column2');
if($productColumn2.length > 0){
$productColumn2.on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: false,
autoplay: false,
autoplayTimeout: 8000,
items: 2,
dots:false,
margin: 20,
responsiveClass:true,
responsive:{
0:{
items:1,
},
768:{
items:1,
},
992:{
items:2,
},
}
});
}
/*---smallp column2 activation---*/
var $smallpColumn2 = $('.smallp_column2');
if($smallpColumn2.length > 0){
$('.smallp_column2').on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 2,
dots:false,
margin: 20,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
768:{
items:1,
},
992:{
items:2,
},
}
});
}
/*---product column1 activation---*/
var $productColumn1 = $('.product_column1');
if($productColumn1.length > 0){
$('.product_column1').on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 2,
dots:false,
margin: 20,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
768:{
items:2,
},
992:{
items:1,
},
}
});
}
/*---deals3 column1 activation---*/
var $deals3Column1 = $('.deals3_column1');
if($deals3Column1.length > 0){
$('.deals3_column1').on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 1,
dots:false,
margin: 20,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
576:{
items:2,
},
768:{
items:1,
},
992:{
items:1,
},
}
});
}
/*---smallp4 left column1 activation---*/
var $smallp4LeftColumn1 = $('.smallp4_left_column1');
if($smallp4LeftColumn1.length > 0){
$('.smallp4_left_column1').on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 1,
dots:false,
margin: 20,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
768:{
items:1,
},
992:{
items:1,
},
}
});
}
/*---blog column3 activation---*/
var $blogColumn3 = $('.blog_column3');
if($blogColumn3.length > 0){
$('.blog_column3').owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 3,
dots:false,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
768:{
items:2,
},
992:{
items:3,
},
}
});
}
/*---brand container activation---*/
var $brandContainer = $('.brand_container');
if($brandContainer.length > 0){
$('.brand_container').on('changed.owl.carousel initialized.owl.carousel', function (event) {
$(event.target).find('.owl-item').removeClass('last').eq(event.item.index + event.page.size - 1).addClass('last')}).owlCarousel({
loop: true,
nav: false,
autoplay: false,
autoplayTimeout: 8000,
items: 5,
margin: 20,
dots:false,
responsiveClass:true,
responsive:{
0:{
items:1,
},
300:{
items:2,
margin: 15,
},
480:{
items:3,
},
768:{
items:4,
},
992:{
items:5,
},
}
});
}
/*---testimonial column1 activation---*/
var $testimonialColumn1 = $('.testimonial_column1');
if($testimonialColumn1.length > 0){
$('.testimonial_column1').owlCarousel({
loop: true,
nav: false,
autoplay: false,
autoplayTimeout: 8000,
items: 1,
dots:true,
});
}
/*---testimonial active activation---*/
var $testimonialTwo = $('.testimonial-two');
if($testimonialTwo.length > 0){
$('.testimonial-two').owlCarousel({
loop: true,
nav: false,
autoplay: false,
autoplayTimeout: 8000,
items: 1,
dots: true,
})
}
/*---blog thumb activation---*/
var $blogThumbActive = $('.blog_thumb_active');
if($blogThumbActive.length > 0){
$('.blog_thumb_active').owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 1,
navText: [' ',' '],
});
}
/*---single product activation---*/
var $singleProductActive = $('.single-product-active');
if($singleProductActive.length > 0){
$('.single-product-active').owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 2,
margin:15,
dots:false,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
320:{
items:2,
},
}
});
}
/*---product navactive activation---*/
var $productNavactive = $('.product_navactive');
if($productNavactive.length > 0){
$('.product_navactive').owlCarousel({
loop: true,
nav: true,
autoplay: false,
autoplayTimeout: 8000,
items: 4,
dots:false,
navText: [' ',' '],
responsiveClass:true,
responsive:{
0:{
items:1,
},
250:{
items:2,
},
480:{
items:3,
},
768:{
items:4,
},
}
});
}
$('.modal').on('shown.bs.modal', function (e) {
$('.product_navactive').resize();
})
$('.product_navactive a').on('click',function(e){
e.preventDefault();
var $href = $(this).attr('href');
$('.product_navactive a').removeClass('active');
$(this).addClass('active');
$('.product-details-large .tab-pane').removeClass('active show');
$('.product-details-large '+ $href ).addClass('active show');
})
/*---elevateZoom---*/
$("#zoom1").elevateZoom({
gallery:'gallery_01',
responsive : true,
cursor: 'crosshair',
zoomType : 'inner'
});
})(jQuery);