Skip to content

Commit

Permalink
fix an initialization issue on IE8-9
Browse files Browse the repository at this point in the history
  • Loading branch information
ganlanyuan committed Nov 3, 2016
1 parent c0ef641 commit db07fe3
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# tiny-slider
![version](https://img.shields.io/badge/Version-0.6.3-green.svg)
![version](https://img.shields.io/badge/Version-0.6.4-green.svg)
Tiny slider for all purposes, inspired by [Owl Carousel](http://owlcarousel.owlgraphic.com/).
Works on morden browsers and IE8+.
[demo](http://creatiointl.org/william/tiny-slider/v1/demo/)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiny-slider",
"version": "0.6.3",
"version": "0.6.4",
"homepage": "https://github.com/ganlanyuan/tiny-slider",
"authors": [
"WilliamLin <[email protected]>"
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

#### v0.6.4
- Fixed: an initialization issue on IE8-9.

#### v0.6.3
- Added: `getIndex` method.
- Improved: set index to real index.
Expand Down
2 changes: 1 addition & 1 deletion dist/min/tiny-slider.ie8.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/min/tiny-slider.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/min/tiny-slider.native.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions dist/tiny-slider.ie8.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ if (!Object.keys) {
return keys;
};
}
// Array.isArray
if (!Array.isArray) {
Array.isArray = function(obj) {
return Object.prototype.toString.call(obj) == "[object Array]";
};
}
// addEventListener
// removeEventListener
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility
Expand Down
8 changes: 5 additions & 3 deletions dist/tiny-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ gn.unwrap = function (els) {
};
/**
* tiny-slider
* @version 0.6.3
* @version 0.6.4
* @author William Lin
* @license The MIT License (MIT)
* @github https://github.com/ganlanyuan/tiny-slider/
Expand Down Expand Up @@ -784,8 +784,10 @@ var tinySlider = (function () {
}
}
slideContainer.classList.add('tiny-content', mode, direction);
slideContainer.style.cssText += 'width: ' + (slideWidth + 1) * slideCountNew + 'px; ' +
'margin-left: ' + gap + 'px; ' + TRANSFORM + ': translate3d(' + (-index * slideWidth) + 'px, 0px, 0px);';
var size = 'width: ' + (slideWidth + 1) * slideCountNew + 'px; ',
x = (-index * slideWidth),
transforms = (TRANSFORM) ? TRANSFORM + ': translate3d(' + x + 'px, 0px, 0px)' : 'left: ' + x + 'px';
slideContainer.style.cssText += size + transforms;
}

// for IE10
Expand Down
8 changes: 5 additions & 3 deletions dist/tiny-slider.native.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* tiny-slider
* @version 0.6.3
* @version 0.6.4
* @author William Lin
* @license The MIT License (MIT)
* @github https://github.com/ganlanyuan/tiny-slider/
Expand Down Expand Up @@ -214,8 +214,10 @@ var tinySlider = (function () {
}
}
slideContainer.classList.add('tiny-content', mode, direction);
slideContainer.style.cssText += 'width: ' + (slideWidth + 1) * slideCountNew + 'px; ' +
'margin-left: ' + gap + 'px; ' + TRANSFORM + ': translate3d(' + (-index * slideWidth) + 'px, 0px, 0px);';
var size = 'width: ' + (slideWidth + 1) * slideCountNew + 'px; ',
x = (-index * slideWidth),
transforms = (TRANSFORM) ? TRANSFORM + ': translate3d(' + x + 'px, 0px, 0px)' : 'left: ' + x + 'px';
slideContainer.style.cssText += size + transforms;
}

// for IE10
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiny-slider",
"version": "0.6.3",
"version": "0.6.4",
"description": "Pure tiny javascript slider for all purposes.",
"main": "dist/tiny-slider.js",
"style": "dist/tiny-slider.css",
Expand Down
8 changes: 5 additions & 3 deletions src/tiny-slider.native.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* tiny-slider
* @version 0.6.3
* @version 0.6.4
* @author William Lin
* @license The MIT License (MIT)
* @github https://github.com/ganlanyuan/tiny-slider/
Expand Down Expand Up @@ -214,8 +214,10 @@ var tinySlider = (function () {
}
}
slideContainer.classList.add('tiny-content', mode, direction);
slideContainer.style.cssText += 'width: ' + (slideWidth + 1) * slideCountNew + 'px; ' +
'margin-left: ' + gap + 'px; ' + TRANSFORM + ': translate3d(' + (-index * slideWidth) + 'px, 0px, 0px);';
var size = 'width: ' + (slideWidth + 1) * slideCountNew + 'px; ',
x = (-index * slideWidth),
transforms = (TRANSFORM) ? TRANSFORM + ': translate3d(' + x + 'px, 0px, 0px)' : 'left: ' + x + 'px';
slideContainer.style.cssText += size + transforms;
}

// for IE10
Expand Down

0 comments on commit db07fe3

Please sign in to comment.