vendor/assets/javascripts/uikit/core/offcanvas.js in uikit2-rails-0.1.4 vs vendor/assets/javascripts/uikit/core/offcanvas.js in uikit2-rails-0.1.5

- old
+ new

@@ -1,6 +1,6 @@ -/*! UIkit 2.24.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +/*! UIkit 2.24.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(UI) { "use strict"; var scrollpos = {x: window.scrollX, y: window.scrollY}, @@ -96,11 +96,11 @@ e.stopImmediatePropagation(); Offcanvas.hide(); }); - element.on("click", "a[href^='#']", function(e){ + element.on("click", "a[href*='#']", function(e){ var link = UI.$(this), href = link.attr("href"); if (href == "#") { @@ -110,19 +110,19 @@ UI.$doc.one('hide.uk.offcanvas', function() { var target; try { - target = UI.$(href); + target = UI.$(link[0].hash); } catch (e){ - target = ""; + target = ''; } if (!target.length) { - target = UI.$('[name="'+href.replace('#','')+'"]'); + target = UI.$('[name="'+link[0].hash.replace('#','')+'"]'); } - if (target.length && link.attr('data-uk-smooth-scroll') && UI.Utils.scrollToElement) { + if (target.length && UI.Utils.scrollToElement) { UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}')); } else { window.location.href = href; } });