/
fullpage.js
95 lines (79 loc) · 2.72 KB
/
fullpage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import './bindings.js';
import './dynamic.js';
import './normalScrollElements.js';
import './resize.js';
import './anchors/index.js';
import './beyondFullpage/index.js';
import './common/scrollTo.js';
import './keyboard/index.js';
import './menu/index.js';
import './nav/index.js';
import './scroll/index.js';
import './slides/index.js';
import './mixed/waterMark.js';
import './mixed/index.min.js';
import * as utils from './common/utils.js';
import { setOptions, setOption, getOptions } from './common/options.js';
import { setContainer, getContainer } from './common/options.js';
import { init } from './instance.js';
import { FP, win } from './common/constants.js';
import { $html, setCache } from './common/cache.js';
import { displayWarnings } from './console.js';
import { ENABLED } from './common/selectors.js';
import { EventEmitter } from './common/eventEmitter.js';
export default function fullpage(containerSelector, options) {
setCache();
//only once my friend!
if(utils.hasClass($html, ENABLED)){ displayWarnings(); return; }
setOption('touchWrapper', typeof containerSelector === 'string' ? utils.$(containerSelector)[0] : containerSelector);
// Creating some defaults, extending them with any options that were provided
setOptions(options);
setContainer(typeof containerSelector === 'string' ? utils.$(containerSelector)[0] : containerSelector);
EventEmitter.emit('onInitialise');
displayWarnings();
setAPI();
if(getContainer()){
EventEmitter.emit('beforeInit');
init();
EventEmitter.emit('bindEvents');
}
// @ts-ignore
return win.fullpage_api;
}
function setAPI(){
FP.getFullpageData = function(){
return {
options: getOptions()
};
};
//public functions
FP.version = '4.0.2';
FP.test = Object.assign(FP.test, {
top: '0px',
translate3d: 'translate3d(0px, 0px, 0px)',
translate3dH: (function(){
var a = [];
for(var i = 0; i < utils.$(getOptions().sectionSelector, getContainer()).length; i++){
a.push('translate3d(0px, 0px, 0px)');
}
return a;
})(),
left: (function(){
var a = [];
for(var i = 0; i < utils.$(getOptions().sectionSelector, getContainer()).length; i++){
a.push(0);
}
return a;
})(),
options: getOptions(),
setAutoScrolling: null
});
//functions we want to share across files but which are not
//mean to be used on their own by developers
FP.shared = Object.assign(FP.shared, {
afterRenderActions: null,
isNormalScrollElement: false
});
// @ts-ignore
win.fullpage_api = FP;
}