Skip to content

Commit

Permalink
Minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
itchief committed May 4, 2020
1 parent 5f1c83a commit 74b2034
Show file tree
Hide file tree
Showing 18 changed files with 65 additions and 74 deletions.
10 changes: 5 additions & 5 deletions chiefSlider/chiefslider-example-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style>
/*!
* chiefSlider (https://github.com/itchief/how-to/tree/master/chiefSlider)
* Copyright 2018 Alexander Maltsev
* Copyright 2020 Alexander Maltsev
* Licensed under MIT (https://github.com/itchief/how-to/blob/master/LICENSE)
*/

Expand Down Expand Up @@ -139,8 +139,8 @@

var position = {
getMin: 0,
getMax: _items.length - 1,
}
getMax: _items.length - 1
};

var _transformItem = function (direction) {
if (direction === 'right') {
Expand Down Expand Up @@ -170,7 +170,7 @@
_transform += _step;
}
_sliderWrapper.style.transform = 'translateX(' + _transform + '%)';
}
};

// обработчик события click для кнопок "назад" и "вперед"
var _controlClick = function (e) {
Expand All @@ -186,7 +186,7 @@
_sliderControls.forEach(function (item) {
item.addEventListener('click', _controlClick);
});
}
};

// инициализация
_setUpListeners();
Expand Down
10 changes: 5 additions & 5 deletions chiefSlider/chiefslider-example-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style>
/*!
* chiefSlider (https://github.com/itchief/how-to/tree/master/chiefSlider)
* Copyright 2018 Alexander Maltsev
* Copyright 2020 Alexander Maltsev
* Licensed under MIT (https://github.com/itchief/how-to/blob/master/LICENSE)
*/

Expand Down Expand Up @@ -148,8 +148,8 @@

var position = {
getMin: 0,
getMax: _items.length - 1,
}
getMax: _items.length - 1
};

var _transformItem = function (direction) {
if (direction === 'right') {
Expand Down Expand Up @@ -179,7 +179,7 @@
_transform += _step;
}
_sliderWrapper.style.transform = 'translateX(' + _transform + '%)';
}
};

// обработчик события click для кнопок "назад" и "вперед"
var _controlClick = function (e) {
Expand All @@ -195,7 +195,7 @@
_sliderControls.forEach(function (item) {
item.addEventListener('click', _controlClick);
});
}
};

// инициализация
_setUpListeners();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style>
/*!
* chiefSlider (https://github.com/itchief/how-to/tree/master/chiefSlider)
* Copyright 2018 Alexander Maltsev
* Copyright 2020 Alexander Maltsev
* Licensed under MIT (https://github.com/itchief/how-to/blob/master/LICENSE)
*/

Expand Down Expand Up @@ -172,7 +172,7 @@
getMax: function () {
return _items[position.getItemMax()].position;
}
}
};

var _transformItem = function (direction) {
var nextItem;
Expand All @@ -197,7 +197,7 @@
_transform += _step;
}
_sliderWrapper.style.transform = 'translateX(' + _transform + '%)';
}
};

var _cycle = function (direction) {
if (!_config.isCycling) {
Expand All @@ -206,7 +206,7 @@
_interval = setInterval(function () {
_transformItem(direction);
}, _config.interval);
}
};

// обработчик события click для кнопок "назад" и "вперед"
var _controlClick = function (e) {
Expand All @@ -233,7 +233,7 @@
_cycle(_config.direction);
});
}
}
};

// инициализация
_setUpListeners();
Expand All @@ -260,7 +260,7 @@
}
}());

var slider = multiItemSlider('.slider', {
multiItemSlider('.slider', {
isCycling: true
})

Expand Down
10 changes: 5 additions & 5 deletions chiefSlider/chiefslider-with-looping.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style>
/*!
* chiefSlider (https://github.com/itchief/how-to/tree/master/chiefSlider)
* Copyright 2018 Alexander Maltsev
* Copyright 2020 Alexander Maltsev
* Licensed under MIT (https://github.com/itchief/how-to/blob/master/LICENSE)
*/

Expand Down Expand Up @@ -159,7 +159,7 @@
getMax: function () {
return _items[position.getItemMax()].position;
}
}
};

var _transformItem = function (direction) {
var nextItem;
Expand All @@ -184,7 +184,7 @@
_transform += _step;
}
_sliderWrapper.style.transform = 'translateX(' + _transform + '%)';
}
};

// обработчик события click для кнопок "назад" и "вперед"
var _controlClick = function (e) {
Expand All @@ -200,7 +200,7 @@
_sliderControls.forEach(function (item) {
item.addEventListener('click', _controlClick);
});
}
};

// инициализация
_setUpListeners();
Expand All @@ -217,7 +217,7 @@
}
}());

var slider = multiItemSlider('.slider')
multiItemSlider('.slider');

</script>

Expand Down
20 changes: 10 additions & 10 deletions chiefSlider/chiefslider-with-refresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style>
/*!
* chiefSlider (https://github.com/itchief/how-to/tree/master/chiefSlider)
* Copyright 2018 Alexander Maltsev
* Copyright 2020 Alexander Maltsev
* Licensed under MIT (https://github.com/itchief/how-to/blob/master/LICENSE)
*/

Expand Down Expand Up @@ -187,7 +187,7 @@
_index = index;
});
_states[_index].active = true;
}
};

_setActive();

Expand All @@ -199,7 +199,7 @@
}
});
return _index;
}
};

// наполнение массива _items
_sliderItems.forEach(function (item, index) {
Expand Down Expand Up @@ -231,7 +231,7 @@
getMax: function () {
return _items[position.getItemMax()].position;
}
}
};

var _transformItem = function (direction) {
var nextItem;
Expand Down Expand Up @@ -261,7 +261,7 @@
_transform += _step;
}
_sliderWrapper.style.transform = 'translateX(' + _transform + '%)';
}
};

var _cycle = function (direction) {
if (!_config.isCycling) {
Expand All @@ -270,7 +270,7 @@
_interval = setInterval(function () {
_transformItem(direction);
}, _config.interval);
}
};

// обработчик события click для кнопок "назад" и "вперед"
var _controlClick = function (e) {
Expand All @@ -291,7 +291,7 @@
clearInterval(_interval);
_cycle(_config.direction);
}
}
};

var _refresh = function () {
clearInterval(_interval);
Expand All @@ -315,7 +315,7 @@
_sliderItems.forEach(function (item, index) {
_items.push({ item: item, position: index, transform: 0 });
});
}
};


var _setUpListeners = function () {
Expand Down Expand Up @@ -346,7 +346,7 @@
_refresh();
}
});
}
};

// инициализация
_setUpListeners();
Expand Down Expand Up @@ -379,7 +379,7 @@
}
}());

var slider = multiItemSlider('.slider', {
multiItemSlider('.slider', {
isCycling: true
})

Expand Down
14 changes: 7 additions & 7 deletions chiefSlider/chiefslider-with-visibilitychange.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style>
/*!
* chiefSlider (https://github.com/itchief/how-to/tree/master/chiefSlider)
* Copyright 2018 Alexander Maltsev
* Copyright 2020 Alexander Maltsev
* Licensed under MIT (https://github.com/itchief/how-to/blob/master/LICENSE)
*/

Expand Down Expand Up @@ -191,7 +191,7 @@
getMax: function () {
return _items[position.getItemMax()].position;
}
}
};

var _transformItem = function (direction) {
var nextItem;
Expand Down Expand Up @@ -221,7 +221,7 @@
_transform += _step;
}
_sliderWrapper.style.transform = 'translateX(' + _transform + '%)';
}
};

var _cycle = function (direction) {
if (!_config.isCycling) {
Expand All @@ -230,7 +230,7 @@
_interval = setInterval(function () {
_transformItem(direction);
}, _config.interval);
}
};

// обработчик события click для кнопок "назад" и "вперед"
var _controlClick = function (e) {
Expand All @@ -251,7 +251,7 @@
clearInterval(_interval);
_cycle(_config.direction);
}
}
};

var _setUpListeners = function () {
// добавление к кнопкам "назад" и "вперед" обрботчика _controlClick для событя click
Expand All @@ -268,7 +268,7 @@
});
}
document.addEventListener('visibilitychange', _handleVisibilityChange, false);
}
};

// инициализация
_setUpListeners();
Expand Down Expand Up @@ -297,7 +297,7 @@
}
}());

var slider = multiItemSlider('.slider', {
multiItemSlider('.slider', {
isCycling: true
})

Expand Down
10 changes: 5 additions & 5 deletions chiefSlider/chiefslider.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style>
/*!
* chiefSlider (https://github.com/itchief/how-to/tree/master/chiefSlider)
* Copyright 2018 Alexander Maltsev
* Copyright 2020 Alexander Maltsev
* Licensed under MIT (https://github.com/itchief/how-to/blob/master/LICENSE)
*/

Expand Down Expand Up @@ -139,8 +139,8 @@

var position = {
getMin: 0,
getMax: _items.length - 1,
}
getMax: _items.length - 1
};

var _transformItem = function (direction) {
if (direction === 'right') {
Expand Down Expand Up @@ -170,7 +170,7 @@
_transform += _step;
}
_sliderWrapper.style.transform = 'translateX(' + _transform + '%)';
}
};

// обработчик события click для кнопок "назад" и "вперед"
var _controlClick = function (e) {
Expand All @@ -186,7 +186,7 @@
_sliderControls.forEach(function (item) {
item.addEventListener('click', _controlClick);
});
}
};

// инициализация
_setUpListeners();
Expand Down
2 changes: 1 addition & 1 deletion modal/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
// создаём модальное окно
var modal = $modal();
// при клике по кнопке #show-modal
document.querySelector('#show-modal').addEventListener('click', function (e) {
document.querySelector('#show-modal').addEventListener('click', function () {
// отобразим модальное окно
modal.show();
});
Expand Down
7 changes: 2 additions & 5 deletions slider/main.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Slider (https://github.com/itchief/how-to/tree/master/slider)
* Copyright 2019 Alexander Maltsev
* Copyright 2020 Alexander Maltsev
* Licensed under MIT (https://github.com/itchief/how-to/blob/master/LICENSE)
*/

Expand Down Expand Up @@ -99,11 +99,8 @@ body {
display: flex;
justify-content: center;
padding-left: 0;
margin-right: 15%;
margin-left: 15%;
margin: 0 15%;
list-style: none;
margin-top: 0;
margin-bottom: 0;
}

.slider__indicators li {
Expand Down
Loading

0 comments on commit 74b2034

Please sign in to comment.