Skip to content

Commit d309822

Browse files
authored
Merge pull request #4650 from alvarotrigo/dev
Merging dev branch 4.0.28
2 parents 113df19 + 5376a34 commit d309822

29 files changed

+154
-52
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
---
2121

22-
![fullPage.js version](https://img.shields.io/badge/fullPage.js-v4.0.27-brightgreen.svg)
22+
![fullPage.js version](https://img.shields.io/badge/fullPage.js-v4.0.28-brightgreen.svg)
2323
[![License](https://img.shields.io/badge/License-GPL-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
2424
[![PayPal Donate](https://img.shields.io/badge/donate-PayPal.me-ff69b4.svg)](https://www.paypal.me/alvarotrigo/9.95)
2525
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/fullpage.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/fullpage.js)
@@ -257,6 +257,7 @@ var myFullpage = new fullpage('#fullpage', {
257257
slideSelector: '.slide',
258258

259259
lazyLoading: true,
260+
lazyLoadThreshold: 0,
260261
observer: true,
261262
credits: { enabled: true, label: 'Made with fullPage.js', position: 'right'},
262263

@@ -507,7 +508,7 @@ It requires the file `vendors/easings.min.js` or [jQuery UI](https://jqueryui.co
507508

508509
### continuousVertical
509510

510-
(default `false`) Defines whether scrolling down in the last section should scroll down to the first one and if scrolling up in the first section should scroll up to the last one. Not compatible with `loopTop`, `loopBottom` or any scroll bar present in the site (`scrollBar:true` or `autoScrolling:false`).
511+
(default `false`) Defines whether scrolling down in the last section should scroll down to the first one and if scrolling1 up in the first section should scroll up to the last one. Not compatible with `loopTop`, `loopBottom` or any scroll bar present in the site (`scrollBar:true` or `autoScrolling:false`).
511512

512513
### continuousHorizontal
513514

@@ -677,6 +678,9 @@ Allows you to configure the parameters for the cards effect when using the optio
677678

678679
(default `true`) Lazy loading is active by default which means it will lazy load any media element containing the attribute `data-src` as detailed in the [Lazy Loading docs](https://github.com/alvarotrigo/fullPage.js#lazy-loading) . If you want to use any other lazy loading library you can disable this fullpage.js feature.
679680

681+
### lazyLoadThreshold
682+
(default `0`) Specifies the number of adjacent vertical sections and horizontal slides whose media elements should be lazy-loaded relative to the current one. Use a number to specify how many previous and next sections or slides should be preloaded.
683+
680684
### observer
681685

682686
(default `true`) Defines whether or not to observe changes in the HTML structure of the page. When enabled, fullPage.js will automatically react to those changes and update itself accordingly. Ideal when adding, removing or hidding sections or slides.

dist/fullpage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* fullPage 4.0.27
2+
* fullPage 4.0.28
33
* https://github.com/alvarotrigo/fullPage.js
44
*
55
* @license GPLv3 for open source use only

dist/fullpage.extensions.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/fullpage.js

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* fullPage 4.0.27
2+
* fullPage 4.0.28
33
* https://github.com/alvarotrigo/fullPage.js
44
*
55
* @license GPLv3 for open source use only
@@ -1206,6 +1206,7 @@
12061206
afterResponsive: null,
12071207
onScrollOverflow: null,
12081208
lazyLoading: true,
1209+
lazyLoadThreshold: 0,
12091210
observer: true,
12101211
scrollBeyondFullpage: true
12111212
};
@@ -1834,6 +1835,24 @@
18341835
}
18351836
});
18361837
}
1838+
function lazyLoadPanels(panel) {
1839+
var lazyLoadThresold = getOptions().lazyLoadThreshold;
1840+
lazyLoad(panel.item);
1841+
1842+
if (lazyLoadThresold) {
1843+
lazyLoadDirection(panel, 'prev', lazyLoadThresold);
1844+
lazyLoadDirection(panel, 'next', lazyLoadThresold);
1845+
}
1846+
} // Lazy load "count" number of panels in a specific direction
1847+
1848+
function lazyLoadDirection(startPanel, direction, count) {
1849+
var currentPanel = startPanel;
1850+
1851+
for (var i = 0; i < count && (currentPanel = currentPanel[direction]()); i++) {
1852+
console.log(currentPanel.item);
1853+
lazyLoad(currentPanel.item);
1854+
}
1855+
}
18371856

18381857
/**
18391858
* Sets a class for the body of the page depending on the active section / slide
@@ -2257,7 +2276,7 @@
22572276

22582277
$(SECTION_SEL + ':not(' + ACTIVE_SEL + ')').forEach(function (section) {
22592278
if (isSectionInViewport(section)) {
2260-
lazyLoad(section);
2279+
lazyLoadPanels(getPanelByElement(section));
22612280
}
22622281
});
22632282
}
@@ -2519,7 +2538,7 @@
25192538
addClass(element, ACTIVE);
25202539
removeClass(siblings(element), ACTIVE);
25212540
updateState();
2522-
lazyLoad(element); //preventing from activating the MouseWheelHandler event
2541+
lazyLoadPanels(section); //preventing from activating the MouseWheelHandler event
25232542
//more than once if the page is scrolling
25242543

25252544
setState({
@@ -3174,7 +3193,7 @@
31743193

31753194
if (!v.localIsResizing) {
31763195
stopMedia(v.prevSlide);
3177-
lazyLoad(destiny);
3196+
lazyLoadPanels(slide);
31783197
}
31793198

31803199
toggleControlArrows(v); //only changing the URL if the slides are in the current section (not for resize re-adjusting)
@@ -5308,7 +5327,7 @@
53085327
}
53095328

53105329
stopMedia(leavingSection);
5311-
lazyLoad(currentSectionElem);
5330+
lazyLoadPanels(currentSection);
53125331
playMedia(currentSectionElem);
53135332
activateMenuAndNav(anchorLink, sectionIndex - 1);
53145333

@@ -5508,7 +5527,7 @@
55085527
});
55095528
});
55105529
var t = ["-"];
5511-
var n = "\x32\x30\x32\x34\x2d\x37\x2d\x31\x39".split("-"),
5530+
var n = "\x32\x30\x32\x34\x2d\x37\x2d\x32\x32".split("-"),
55125531
e = new Date(n[0], n[1], n[2]),
55135532
r = ["se", "licen", "-", "v3", "l", "gp"];
55145533

@@ -5661,7 +5680,7 @@
56615680
var section = getState().activeSection;
56625681
var sectionElem = getState().activeSection.item;
56635682
addClass(sectionElem, COMPLETELY);
5664-
lazyLoad(sectionElem);
5683+
lazyLoadPanels(getState().activeSection);
56655684
lazyLoadOthers();
56665685
playMedia(sectionElem);
56675686

@@ -5969,7 +5988,7 @@
59695988
}; //public functions
59705989

59715990

5972-
FP.version = '4.0.27';
5991+
FP.version = '4.0.28';
59735992
FP.test = Object.assign(FP.test, {
59745993
top: '0px',
59755994
translate3d: 'translate3d(0px, 0px, 0px)',

dist/fullpage.min.css

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

dist/fullpage.min.css.map

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

dist/fullpage.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.background": "#193318",
4+
"titleBar.activeBackground": "#244822",
5+
"titleBar.activeForeground": "#F6FBF6"
6+
}
7+
}

examples/lazy-load.html

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
66
<title>Lazy load - fullPage.js</title>
77
<meta name="author" content="Alvaro Trigo Lopez" />
8-
<meta name="description" content="fullPage full-screen normal scrolling with autoScrolling." />
8+
<meta name="description" content="fullPage Lazy Load Demo." />
99
<meta name="keywords" content="fullpage,jquery,demo,screen,fullscreen,lazyload,lazy,passive,load,src,data-src,media" />
1010
<meta name="Resource-type" content="Document" />
1111

12-
1312
<link rel="stylesheet" type="text/css" href="../dist/fullpage.css" />
1413
<link rel="stylesheet" type="text/css" href="examples.css" />
1514
<style>
@@ -126,10 +125,22 @@ <h1>Lazy load</h1>
126125
<p>Just use `data-src` or `data-srcset` for media elements.</p>
127126
</div>
128127
</div>
129-
<div class="section" id="section1">
128+
<div class="section "id="section1">
129+
<div class="intro">
130+
<img data-srcset="imgs/2.png, imgs/2.png" alt="1"/>
131+
<h1>Section 2</h1>
132+
</div>
133+
</div>
134+
<div class="section active" id="section2">
135+
<div class="intro">
136+
<img data-srcset="imgs/3.png, imgs/2.png" alt="1"/>
137+
<h1>Section 3</h1>
138+
</div>
139+
</div>
140+
<div class="section" id="section4">
130141
<div class="slide" id="slide1">
131142
<div class="intro">
132-
<h1>Lazy load image</h1>
143+
<h1>Section 4</h1>
133144
<img data-src="imgs/iphone-blue.png" alt="iphone" id="iphone-two" />
134145
</div>
135146
</div>
@@ -145,7 +156,7 @@ <h1>Lazy load video</h1>
145156
</div>
146157

147158
</div>
148-
<div class="section" id="section2">
159+
<div class="section" id="section5">
149160
<div class="intro">
150161
<h1>Lazy load background </h1>
151162
<p>Make use of the `onLeave` callback. See the source code here!</p>
@@ -158,14 +169,23 @@ <h1>Lazy load background </h1>
158169

159170
<script type="text/javascript">
160171
var myFullpage = new fullpage('#fullpage', {
161-
menu: '#menu',
162-
anchors: ['firstPage', 'secondPage', '3rdPage'],
163-
sectionsColor: ['#C63D0F', '#1BBC9B', '#7E8F7C'],
172+
173+
// Lazyload default values
174+
lazyLoading: true,
175+
lazyLoadThreshold: 3,
176+
177+
// To lazy load a background
164178
onLeave: function(origin, destination, direction){
165179
if(destination.index === 2){
166180
destination.item.classList.add('load-background');
167181
}
168-
}
182+
},
183+
184+
// Optional
185+
menu: '#menu',
186+
anchors: ['firstPage', 'secondPage', '3rdPage', '4page', '5page', '6page', '7page'],
187+
sectionsColor: ['#C63D0F', '#1BBC9B', '#7E8F7C','#C63D0F', '#1BBC9B', '#7E8F7C','#C63D0F', '#1BBC9B', '#7E8F7C'],
188+
navigation: true
169189
});
170190
</script>
171191

gulp/build.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ gulp.task('update-version', function(done){
4141
// updating readme version
4242
gulp.src([
4343
'./README.md',
44+
'./lang/brazilian-portuguese/README.md',
4445
'./lang/chinese/README.md',
4546
'./lang/french/README.md',
47+
'./lang/japanese/README.md',
4648
'./lang/korean/README.md',
4749
'./lang/russian/README.md',
48-
'./lang/spanish/README.md',
49-
'./lang/brazilian-portuguese/README.md',
50+
'./lang/spanish/README.md'
5051
], { base: "./" })
5152
.pipe(replace(/(fullPage.js-v)([\d\.]+)/g, "$1" + fpPackage.version))
5253
.pipe(gulp.dest('.'));

0 commit comments

Comments
 (0)