diff --git a/src/js/zoomove.js b/src/js/zoomove.js
index 343f53f..2e73174 100644
--- a/src/js/zoomove.js
+++ b/src/js/zoomove.js
@@ -1,6 +1,6 @@
-(function ( $ ) {
+(function ($) {
- $.fn.ZooMove = function( options ) {
+ $.fn.ZooMove = function (options) {
// config default
var zoo = $.extend({
@@ -8,24 +8,24 @@
cursor: 'false',
scale: '1.5',
move: 'true',
- over: 'false',
- autosize: 'true'
- }, options );
+ over: 'false',
+ autosize: 'true'
+ }, options);
// cursor config
- if($(this).attr('data-zoo-cursor')) { zoo.cursor = $(this).attr('data-zoo-cursor'); }
- if(zoo.cursor === 'true') { zoo.cursor = 'pointer'; }
- else{ zoo.cursor = 'default'; }
+ if ($(this).attr('data-zoo-cursor')) { zoo.cursor = $(this).attr('data-zoo-cursor'); }
+ if (zoo.cursor === 'true') { zoo.cursor = 'pointer'; }
+ else { zoo.cursor = 'default'; }
this
- .each(function(){
+ .each(function () {
var thisZoo = $(this); // cache current jquery zoo element
// if over exist and over true
- if(thisZoo.attr('data-zoo-over')) { zoo.overD = thisZoo.attr('data-zoo-over'); }
- else{ zoo.overD = zoo.over; }
+ if (thisZoo.attr('data-zoo-over')) { zoo.overD = thisZoo.attr('data-zoo-over'); }
+ else { zoo.overD = zoo.over; }
- if(zoo.overD === 'true'){
+ if (zoo.overD === 'true') {
thisZoo.css({
'overflow': 'visible',
'z-index': '100'
@@ -33,83 +33,81 @@
}
// if image exist
- if(thisZoo.attr('data-zoo-image')) { zoo.imageD = thisZoo.attr('data-zoo-image'); }
- else{ zoo.imageD = zoo.image; }
-
- // if autosize exist
- if(thisZoo.attr('data-zoo-autosize')) { zoo.autosizeD = thisZoo.attr('data-zoo-autosize'); }
- else{ zoo.autosizeD = zoo.autosize; }
-
- if(zoo.autosizeD === 'true') {
- $('',{
- load: function(){
- thisZoo.css('width', this.width + 'px')
- thisZoo.css('height', this.height + 'px')
- },
- src: zoo.imageD
- });
- }
+ if (thisZoo.attr('data-zoo-image')) { zoo.imageD = thisZoo.attr('data-zoo-image'); }
+ else { zoo.imageD = zoo.image; }
+
+ // if autosize exist
+ if (thisZoo.attr('data-zoo-autosize')) { zoo.autosizeD = thisZoo.attr('data-zoo-autosize'); }
+ else { zoo.autosizeD = zoo.autosize; }
+
+ if (zoo.autosizeD === 'true') {
+ $('
').on('load', function () {
+ var $this = $(this);
+ thisZoo.css('width', $this.width() + 'px');
+ thisZoo.css('height', $this.height() + 'px');
+ }).attr('src', zoo.imageD);
+ }
// create image element background
thisZoo
.append('