Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function 1() {
- let firstChild = $('.carousel > div:first-child');
- firstChild.remove();
- }
- function 2() {
- $('.carousel').children().each(function() {
- let left = parseInt($(this).attr('style').slice(6, -2)) - 10;
- $(this).css('left', `${left}vw`);
- });
- }
- function previousSlide() {
- 1();
- $('.carousel').append(firstChild);
- $('.carousel > div:last-child').attr('style', `left: ${$('.carousel').children().length * 10 - 10}vw`);
- 2();
- }
- function nextSlide() {
- 1();
- $('.carousel').prepend(lastChild);
- $('.carousel > div:first-child').attr('style', 'left: -10vw;');
- 2();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement