lukehaas / Scrollify

A jQuery plugin that assists scrolling and snaps to sections.
MIT License
1.8k stars 580 forks source link

After editing site (removing sections), pagination still has the previous sections #402

Closed cordial closed 4 years ago

cordial commented 4 years ago

Here are our settings -

jQuery(document).ready(function($) {

$.scrollify({ section: ".section_wrap", sectionName: "section-name", interstitialSection: "#copyright", easing: "easeOutExpo", scrollSpeed: 1100, offset: 0, scrollbars: true, standardScrollElements: ".section-team, .section-projects", updateHash: false, before: function(i, panels) { var ref = panels[i].attr("data-section-name"); $(".pagination .active").removeClass("active"); $(".pagination").find("a[href=\"#" + ref + "\"]").addClass("active"); }, after: function() {}, afterResize: function() {}, afterRender: function() { var pagination = "<ul class=\"pagination\">"; var activeClass = ""; $(".panel").each(function(i) { activeClass = ""; if (i === $.scrollify.currentIndex()) { activeClass = "active"; } pagination += "

  • <a class=\"" + activeClass + "\" href=\"#" + $(this).attr("data-section-name") + "\"><span class=\"hover-text\">" + $(this).attr("data-section-name").charAt(0).toUpperCase() + $(this).attr("data-section-name").slice(1) + "
  • "; });

      pagination += "</ul>";
    
      $(".home").append(pagination);
      $(".pagination a").on("click", $.scrollify.move);
    }

    });

    For some reason, the 'panels' variable in the before method still has 6 sections and 6 are still showing on the site, instead of now having 4. There are only 4 instances of 'section_wrap' in the html. Is that where the variable 'panels' is created from?

    You can see the issue here - https://cooper-collective.com/