From ee1c7cc1bd1c1fcc0a2f7cac7a4f9a18c300ae3e Mon Sep 17 00:00:00 2001 From: Davide Cavarretta Date: Fri, 12 Dec 2014 15:56:40 +0100 Subject: [PATCH] Fix bug first page - do not necessary have a second page --- jquery.jscroll.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jquery.jscroll.js b/jquery.jscroll.js index 829bdb7..807be83 100644 --- a/jquery.jscroll.js +++ b/jquery.jscroll.js @@ -43,11 +43,13 @@ _$scroll = _isWindow ? _$window : $e, _nextHref = $.trim(_$next.attr('href') + ' ' + _options.contentSelector); - // Initialization - $e.data('jscroll', $.extend({}, _data, {initialized: true, waiting: false, nextHref: _nextHref})); - _wrapInnerContent(); - _preloadImage(); - _setBindings(); + if (typeof _$next.attr('href') !== 'undefined' && _$next.attr('href') ){ + // Initialization just if href is defined + $e.data('jscroll', $.extend({}, _data, {initialized: true, waiting: false, nextHref: _nextHref})); + _wrapInnerContent(); + _preloadImage(); + _setBindings(); + } // Private methods