From fcbc01f7f22cc5c37714f7f8187288ec1a3119ec Mon Sep 17 00:00:00 2001 From: Sean Powell Date: Tue, 24 Sep 2019 12:47:11 -0700 Subject: [PATCH 1/2] Fix for anchor links with no ID Bug Fix for breaking links that have '#' placeholder hrefs as is common in javascript enabled links. The new query excludes href='#' --- js/jquery.plusanchor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/jquery.plusanchor.js b/js/jquery.plusanchor.js index 5f9ca7e..8a3cd85 100644 --- a/js/jquery.plusanchor.js +++ b/js/jquery.plusanchor.js @@ -34,15 +34,15 @@ var bodyEl = document.body; function _constructor() { - // If the user selects body, make sure to use 'html, body' for + // If the user selects body, make sure to use 'html, body' for // cross browser compatibility reasons - base.el = el; + base.el = el; base.$el = (el === htmlEl || el === bodyEl) ? $('html, body') : $(el); base.$animationTarget = options.animationTarget ? $(options.animationTarget) : base.$el; base.$el.data('plusAnchor', base); // Add a reverse reference to the DOM object base.animateScrolling = animateScrolling; - var anchorSelector = options.includeCssIndication ? '.js-plus-anchor' : 'a[href^="#"]'; + var anchorSelector = options.includeCssIndication ? '.js-plus-anchor' : 'a[href^="#"]:not([href="#"])';// only select anchor links that are not # by itself // Check for plusanchor disable if (options === false) { From 6706260eb1f637afce241c61eebb5f4cd62b476a Mon Sep 17 00:00:00 2001 From: Sean Powell Date: Tue, 24 Sep 2019 12:53:25 -0700 Subject: [PATCH 2/2] updated info for fork added fork reference until merged back --- js/jquery.plusanchor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/jquery.plusanchor.js b/js/jquery.plusanchor.js index 8a3cd85..8482151 100644 --- a/js/jquery.plusanchor.js +++ b/js/jquery.plusanchor.js @@ -1,12 +1,12 @@ /* * PlusAnchor -* A form component library -* Version: "1.1.2" +* A simple jQuery plugin that scrolls to anchor links instead of instantaneously jumping to them. +* Version: "1.1.2.1" * Jamy Golden * https://github.com/JamyGolden/PlusAnchor +* Fork: sean@onegiantmedia.com | https://github.com/sean-mystyle/PlusAnchor * License: MIT -*/ -(function($){ +*/(function($){ function scrollToEvent(base) { return function(e) {