Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. if (window.location.pathname == "/listing.html") {
  2. if ($('.preview-images').length > 0) {
  3. // Carousel
  4. var slides = $('.preview-images .preview-images-slider div').length,
  5. slideshowWidth = slides * 100 / 3,
  6. slideWidth = 97.26 / slides,
  7. slideshowPosition = 0,
  8. slideshowTimer = 0;
  9. //$('.preview-images .preview-images-slider').css('width', slideshowWidth + '%');
  10. //$('.preview-images .preview-images-slider div').css('width', slideWidth + '%'); // Performs a check to activate/deactivate navigation arrows
  11.  
  12. function slideshowPositionCheck() {
  13. if (slideshowPosition == 0) {
  14. $('#arrow-left').prop('disabled', true);
  15. } else {
  16. $('#arrow-left').prop('disabled', false);
  17. }
  18.  
  19. if (slideshowPosition >= slideshowWidth - 100) {
  20. $('#arrow-right').prop('disabled', true);
  21. } else {
  22. $('#arrow-right').prop('disabled', false);
  23. }
  24. }
  25.  
  26. slideshowPositionCheck();
  27. $('#arrow-left').click(function () {
  28. slideshowPosition = slideshowPosition - 100;
  29. slideshowPositionCheck();
  30. $('.preview-images .preview-images-slider').css('right', slideshowPosition + '%');
  31. });
  32. $('#arrow-right').click(function () {
  33. slideshowPosition = slideshowPosition + 100;
  34. slideshowPositionCheck();
  35. $('.preview-images .preview-images-slider').css('right', slideshowPosition + '%');
  36. });
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement