PageSourceSearch

http://mostafavisaffron.com/wp-content/themes/theme_mostafavi/js/home-slider.js?ver=1.0.0

js mostafavisaffron.com collected 2026-10-03 00:33:27 UTC 2,378 bytes, 92 lines download raw bytes

1/**
2 * Mostafavi Home Banner Slider
3 *
4 * JavaScript functionality for the homepage banner slider
5 */
6jQuery(document).ready(function ($) {
7  // Find home slider containers
8  $("[id^=home-slider-]").each(function () {
9    var sliderId = $(this).attr("id");
10    var sliderContainer = $("#" + sliderId);
11    var slides = sliderContainer.find(".custom-slide");
12    var paginationDots = sliderContainer.find(".pagination-dot");
13    var currentSlide = 0;
14    var totalSlides = slides.length;
15
16    // Get slider options from data attributes or use defaults
17    var autoplay =
18      sliderContainer.data("autoplay") === true ||
19      sliderContainer.data("autoplay") === "true";
20    var autoplayDelay = parseInt(sliderContainer.data("delay")) || 5000;
21    var effect = sliderContainer.data("effect") || "fade";
22    var autoplayInterval;
23
24    // Go to specific slide by index
25    function goToSlide(index) {
26      if (index >= totalSlides) {
27        index = 0;
28      } else if (index < 0) {
29        index = totalSlides - 1;
30      }
31
32      slides.removeClass("active");
33      paginationDots.removeClass("active");
34
35      slides.eq(index).addClass("active");
36      paginationDots.eq(index).addClass("active");
37
38      currentSlide = index;
39    }
40
41    // Navigate to next slide
42    function nextSlide() {
43      goToSlide(currentSlide + 1);
44    }
45
46    // Navigate to previous slide
47    function prevSlide() {
48      goToSlide(currentSlide - 1);
49    }
50
51    // Initialize first slide
52    goToSlide(0);
53
54    // Handle pagination dot clicks
55    paginationDots.on("click", function () {
56      var slideIndex = $(this).data("slide-index");
57      goToSlide(slideIndex);
58
59      if (autoplay) {
60        clearInterval(autoplayInterval);
61        startAutoplay();
62      }
63    });
64
65    // Start autoplay if enabled
66    function startAutoplay() {
67      if (autoplay) {
68        autoplayInterval = setInterval(function () {
69          nextSlide();
70        }, autoplayDelay);
71      }
72    }
73
74    // Stop autoplay
75    function stopAutoplay() {
76      clearInterval(autoplayInterval);
77    }
78
79    // Initialize autoplay
80    startAutoplay();
81
82    // Pause autoplay on hover
83    sliderContainer.hover(
84      function () {
85        stopAutoplay();
86      },
87      function () {
88        startAutoplay();
89      }
90    );
91  });
92});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.