Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update js/jquery.smoothDivScroll-1.3.js #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 38 additions & 10 deletions js/jquery.smoothDivScroll-1.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
getContentOnLoad: {}, // Object
countOnlyClass: "", // String
startAtElementId: "", // String
beforeEndDistance : 200, // Pixels

// Hotspot scrolling
hotSpotScrolling: true, // Boolean
Expand Down Expand Up @@ -124,14 +125,14 @@
// Put the right and left hot spot back into the scroller again
// or create them if they where not present from the beginning.
if (el.data("scrollingHotSpotRight").length === 0) {
el.prepend("<div class='" + o.scrollingHotSpotRightClass + "'></div>");
el.prepend("<div class='" + o.scrollingHotSpotRightClass + "'><span>&gt;</span></div>");
el.data("scrollingHotSpotRight", el.find("." + o.scrollingHotSpotRightClass));
} else {
el.prepend(el.data("scrollingHotSpotRight"));
}

if (el.data("scrollingHotSpotLeft").length === 0) {
el.prepend("<div class='" + o.scrollingHotSpotLeftClass + "'></div>");
el.prepend("<div class='" + o.scrollingHotSpotLeftClass + "'><span>&lt;</span></div>");
el.data("scrollingHotSpotLeft", el.find("." + o.scrollingHotSpotLeftClass));
} else {
el.prepend(el.data("scrollingHotSpotLeft"));
Expand Down Expand Up @@ -159,6 +160,7 @@
el.data("enabled", true);
el.data("scrollableAreaHeight", el.data("scrollableArea").height());
el.data("scrollerOffset", el.offset());
el.data("initialAjaxContentLoaded", false);

/*****************************************
SET UP EVENTS FOR TOUCH SCROLLING
Expand Down Expand Up @@ -564,7 +566,7 @@
el.data("scrollingHotSpotLeft").hide();
el.data("scrollingHotSpotRight").show();
// Callback
self._trigger("scrollerLeftLimitReached");
self._trigger("scrollerLeftLimitReached");
// Clear interval
clearInterval(el.data("leftScrollingInterval"));
el.data("leftScrollingInterval", null);
Expand All @@ -576,7 +578,7 @@
el.data("scrollingHotSpotLeft").show();
el.data("scrollingHotSpotRight").hide();
// Callback
self._trigger("scrollerRightLimitReached");
self._trigger("scrollerRightLimitReached");
// Clear interval
clearInterval(el.data("rightScrollingInterval"));
el.data("rightScrollingInterval", null);
Expand All @@ -587,6 +589,12 @@
el.data("scrollingHotSpotLeft").show();
el.data("scrollingHotSpotRight").show();
}
// callback if right end is allmost reached
if (el.data("scrollableAreaWidth") <= (el.data("scrollWrapper").innerWidth() + o.beforeEndDistance + el.data("scrollWrapper").scrollLeft())) {
// Callback

self._trigger("scrollerRightLimitSoon");
}
}
// If auto scrolling is set to always, there should be no hotspots
else {
Expand Down Expand Up @@ -857,7 +865,13 @@
}

// Recalculate the total width of the elements inside the scrollable area
self.recalculateScrollableArea();
// if it's not the initial AJAX content load. If so, it's taken care of
// in the $(window).load eventhandler
if (el.data("initialAjaxContentLoaded")) {
self.recalculateScrollableArea();
} else {
el.data("initialAjaxContentLoaded", true);
}

// Determine which hotspots to show
self._showHideHotSpots();
Expand Down Expand Up @@ -935,7 +949,13 @@
}

// Recalculate the total width of the elements inside the scrollable area
self.recalculateScrollableArea();
// if it's not the initial AJAX content load. If so, it's taken care of
// in the $(window).load eventhandler
if (el.data("initialAjaxContentLoaded")) {
self.recalculateScrollableArea();
} else {
el.data("initialAjaxContentLoaded", true);
}

// Determine which hotspots to show
self._showHideHotSpots();
Expand Down Expand Up @@ -985,8 +1005,14 @@
}

// Recalculate the total width of the elements inside the scrollable area
self.recalculateScrollableArea();

// if it's not the initial AJAX content load. If so, it's taken care of
// in the $(window).load eventhandler
if (el.data("initialAjaxContentLoaded")) {
self.recalculateScrollableArea();
} else {
el.data("initialAjaxContentLoaded", true);
}

// Determine which hotspots to show
self._showHideHotSpots();

Expand Down Expand Up @@ -1023,8 +1049,8 @@
el.data("scrollableArea").width(el.data("scrollableAreaWidth"));

// Move to the starting position
el.data("scrollWrapper").scrollLeft(el.data("startingPosition"));
el.data("scrollXPos", el.data("startingPosition"));
//el.data("scrollWrapper").scrollLeft(el.data("startingPosition"));
//el.data("scrollXPos", el.data("startingPosition"));
},
/**********************************************************
Get current scrolling left offset
Expand Down Expand Up @@ -1245,6 +1271,7 @@

// Set enabled to true
el.data("enabled", true);

},
disable: function () {
var self = this, el = this.element;
Expand All @@ -1257,6 +1284,7 @@

// Set enabled to false
el.data("enabled", false);

},
destroy: function () {
var self = this, el = this.element;
Expand Down