Skip to content

Commit 009b433

Browse files
committed
Refactored code
1 parent fe9cb5d commit 009b433

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"smartscroll.js",
55
"sass/smartscroll.scss"
66
],
7-
"version": "2.1.0",
7+
"version": "2.1.1",
88
"homepage": "https://github.com/d4nyll/smartscroll",
99
"repository": {
1010
"type": "git",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "smartscroll",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Scrolljacking jQuery plugin",
55
"main": "smartscroll.js",
66
"directories": {

smartscroll.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,19 @@
119119
// Update the values for `sections`
120120
var calculateSectionBottoms = function () {
121121
var tmpSections = [];
122+
sectionWrapperTop = Math.round(
123+
sectionWrapper.position().top
124+
+ parseInt(sectionWrapper.css('paddingTop'), 10)
125+
+ parseInt(sectionWrapper.css('borderTopWidth'), 10)
126+
+ parseInt(sectionWrapper.css('marginTop'), 10));
127+
128+
// We use `height()` instead of `innerHeight()` or `outerHeight()`
129+
// because we don't care about the padding in the sectionWrapper at the bottom
130+
sectionWrapperBottom = Math.round(
131+
sectionWrapperTop
132+
+ sectionWrapper.height(), 10);
133+
122134
$(options.sectionSelector).each(function (i, el) {
123-
sectionWrapperTop = Math.round(
124-
sectionWrapper.position().top
125-
+ parseInt(sectionWrapper.css('paddingTop'), 10)
126-
+ parseInt(sectionWrapper.css('borderTopWidth'), 10)
127-
+ parseInt(sectionWrapper.css('marginTop'), 10));
128-
129-
// We use `height()` instead of `innerHeight()` or `outerHeight()`
130-
// because we don't care about the padding in the sectionWrapper at the bottom
131-
sectionWrapperBottom = Math.round(
132-
sectionWrapperTop
133-
+ sectionWrapper.height(), 10);
134-
135135
tmpSections.push(Math.round(
136136
sectionWrapperTop
137137
+ $(el).position().top // This will be relative to the sectionWrapper

smartscroll.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)