Skip to content

Commit

Permalink
Fixed issue #121
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinchoolur committed Apr 14, 2015
1 parent 91ae40a commit f44b65f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 54 deletions.
2 changes: 1 addition & 1 deletion dist/css/lightslider.css
@@ -1,4 +1,4 @@
/*! lightslider - v1.1.2 - 2015-04-07
/*! lightslider - v1.1.2 - 2015-04-14
* https://github.com/sachinchoolur/lightslider
* Copyright (c) 2015 Sachin N; Licensed MIT */
/** /!!! core css Should not edit !!!/**/
Expand Down
59 changes: 33 additions & 26 deletions dist/js/lightslider.js
@@ -1,4 +1,4 @@
/*! lightslider - v1.1.2 - 2015-04-07
/*! lightslider - v1.1.2 - 2015-04-14
* https://github.com/sachinchoolur/lightslider
* Copyright (c) 2015 Sachin N; Licensed MIT */
(function ($, undefined) {
Expand Down Expand Up @@ -323,11 +323,11 @@
this.move($el, slideValue);
}
if (settings.vertical === false) {
this.setHeight($el, false, true);
this.setHeight($el, false);
}

} else {
this.setHeight($el, true, true);
this.setHeight($el, true);
$el.addClass('lSFade');
if (!this.doCss()) {
$children.not('.active').css('display', 'none');
Expand Down Expand Up @@ -429,34 +429,42 @@
refresh.init();
}, 0);
},
setHeight: function (ob, fade, loop) {
var obj = null;
if (loop) {
setHeight: function (ob, fade) {
var obj = null,
$this = this;
if (settings.loop) {
obj = ob.children('.lslide ').first();
} else {
obj = ob.children().first();
}
var setCss = function () {
if (scene === 0) {
var tH = obj.height(),
tP = 0,
tHT = tH;
if (fade) {
tH = 0;
tP = ((tHT) * 100) / elSize;
}
ob.css({
'height': tH + 'px',
'padding-bottom': tP + '%'
});
var tH = obj.outerHeight(),
tP = 0,
tHT = tH;
if (fade) {
tH = 0;
tP = ((tHT) * 100) / elSize;
}
ob.css({
'height': tH + 'px',
'padding-bottom': tP + '%'
});
};
setCss();
obj.find('img').load(function () {
setTimeout(function () {
setCss();
}, 100);
});
if (obj.has('img')) {
obj.find('img').load(function () {
setTimeout(function () {
setCss();
if (!interval) {
$this.auto();
}
}, 100);
});
}else{
if (!interval) {
$this.auto();
}
}
},
active: function (ob, t) {
if (this.doCss() && settings.mode === 'fade') {
Expand Down Expand Up @@ -839,7 +847,6 @@
build: function () {
var $this = this;
$this.initialStyle();
$this.auto();
if (this.doCss()) {

if (settings.enableTouch === true) {
Expand Down Expand Up @@ -892,10 +899,10 @@
if (settings.adaptiveHeight === false) {
if (settings.mode === 'slide') {
if (settings.vertical === false) {
plugin.setHeight($el, false, true);
plugin.setHeight($el, false);
}
} else {
plugin.setHeight($el, true, true);
plugin.setHeight($el, true);
}
}
if (settings.gallery === true) {
Expand Down
4 changes: 2 additions & 2 deletions dist/js/lightslider.min.js

Large diffs are not rendered by default.

57 changes: 32 additions & 25 deletions src/js/lightslider.js
Expand Up @@ -320,11 +320,11 @@
this.move($el, slideValue);
}
if (settings.vertical === false) {
this.setHeight($el, false, true);
this.setHeight($el, false);
}

} else {
this.setHeight($el, true, true);
this.setHeight($el, true);
$el.addClass('lSFade');
if (!this.doCss()) {
$children.not('.active').css('display', 'none');
Expand Down Expand Up @@ -426,34 +426,42 @@
refresh.init();
}, 0);
},
setHeight: function (ob, fade, loop) {
var obj = null;
if (loop) {
setHeight: function (ob, fade) {
var obj = null,
$this = this;
if (settings.loop) {
obj = ob.children('.lslide ').first();
} else {
obj = ob.children().first();
}
var setCss = function () {
if (scene === 0) {
var tH = obj.height(),
tP = 0,
tHT = tH;
if (fade) {
tH = 0;
tP = ((tHT) * 100) / elSize;
}
ob.css({
'height': tH + 'px',
'padding-bottom': tP + '%'
});
var tH = obj.outerHeight(),
tP = 0,
tHT = tH;
if (fade) {
tH = 0;
tP = ((tHT) * 100) / elSize;
}
ob.css({
'height': tH + 'px',
'padding-bottom': tP + '%'
});
};
setCss();
obj.find('img').load(function () {
setTimeout(function () {
setCss();
}, 100);
});
if (obj.has('img')) {
obj.find('img').load(function () {
setTimeout(function () {
setCss();
if (!interval) {
$this.auto();
}
}, 100);
});
}else{
if (!interval) {
$this.auto();
}
}
},
active: function (ob, t) {
if (this.doCss() && settings.mode === 'fade') {
Expand Down Expand Up @@ -836,7 +844,6 @@
build: function () {
var $this = this;
$this.initialStyle();
$this.auto();
if (this.doCss()) {

if (settings.enableTouch === true) {
Expand Down Expand Up @@ -889,10 +896,10 @@
if (settings.adaptiveHeight === false) {
if (settings.mode === 'slide') {
if (settings.vertical === false) {
plugin.setHeight($el, false, true);
plugin.setHeight($el, false);
}
} else {
plugin.setHeight($el, true, true);
plugin.setHeight($el, true);
}
}
if (settings.gallery === true) {
Expand Down

0 comments on commit f44b65f

Please sign in to comment.