- Notifications
You must be signed in to change notification settings - Fork0
fullPage plugin by Alvaro Trigo. Create full screen pages fast and simple
kwan838/fullPage.js
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple and easy to use plugin to create fullscreen scrolling websites (also known as single page websites).It allows the creation of fullscreen scrolling websites, as well as adding some landscape sliders inside the sections of the site.
Customizations of the plugin available upon request for some reasonable price.Contact me.
Would you like to have a website using fullpage.js functionality but you don't know how to use it? I can do it for you for a reasonable price.Contact me.
Suggestion are more than welcome, not only for feature requests but also for coding style improvements.Let's make this a great plugin to make people's lives easier!
fullPage.js is fully functional on all modern browsers, as well as some old ones such as Internet Explorer 8, 9, Opera 12, etc.It works with browsers with CSS3 support and with the ones which don't have it, making it ideal for old browsers compatibility.
As you can see in the example files, you will need to include the JavaScript filejquery.fullPage.js
(or the minified versionjquery.fullPage.min.js
) and the css filejquery.fullPage.css
of the plugin, as well asjQuery. Optionally, you can add thejQuery UI library in case you want to use other easing effects apart from the ones included in the jQuery library which are thelinear
orswing
effects. (easeInQuart
is active by default, so you would needjQuery UI library or the customized version which is included in the vendors folder under the namejquery.easings.min.js
.)
###Including files:
<linkrel="stylesheet"type="text/css"href="jquery.fullPage.css"/><scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><!-- This following line is needed in case of using the default easing option or when using another one rather than "linear" or "swing". You can also add the full jQuery UI instead of this file if you prefer --><scriptsrc="vendors/jquery.easings.min.js"></script><!-- This following line needed in the case of using the plugin option `scrollOverflow:true` --><scripttype="text/javascript"src="vendors/jquery.slimscroll.min.js"></script><scripttype="text/javascript"src="jquery.fullPage.js"></script>
###Required HTML structureEach section will be defined with adiv
containing thesection
class.The active section by default will be the first section, which is taken as the home page.
<divid="fullpage"><divclass="section">Some section</div><divclass="section">Some section</div><divclass="section">Some section</div><divclass="section">Some section</div></div>
If you want to define a different starting point rather than the first section or the first slide of a section, just add the classactive
to the section and slide you want to load first.
<divclass="section active">Some section</div>
In order to create a landscape slider within a section, each slide will be defined with anotherdiv
:
<divclass="section"><divclass="slide"> Slide 1</div><divclass="slide"> Slide 2</div><divclass="slide"> Slide 3</div><divclass="slide"> Slide 4</div></div>
You can see a fully working example of the HTML structure in thedemoPage.html
file.
###InitializationAll you need to do is call the plugin inside a$(document).ready
function:
$(document).ready(function(){$('#fullpage').fullpage();});
A more complex initialization with all options set could look like this:
$(document).ready(function(){$('#fullpage').fullpage({verticalCentered:true,resize :true,sectionsColor :['#ccc','#fff'],anchors:['firstSlide','secondSlide'],scrollingSpeed:700,easing:'easeInQuart',menu:false,navigation:false,navigationPosition:'right',navigationTooltips:['firstSlide','secondSlide'],slidesNavigation:true,slidesNavPosition:'bottom',loopBottom:false,loopTop:false,loopHorizontal:true,autoScrolling:true,scrollOverflow:false,css3:false,paddingTop:'3em',paddingBottom:'10px',normalScrollElements:'#element1, .element2',normalScrollElementTouchThreshold:5,keyboardScrolling:true,touchSensitivity:15,continuousVertical:false,animateAnchor:true,sectionSelector:'.section',slideSelector:'.slide',//eventsonLeave:function(index,nextIndex,direction){},afterLoad:function(anchorLink,index){},afterRender:function(){},afterResize:function(){},afterSlideLoad:function(anchorLink,index,slideAnchor,slideIndex){},onSlideLeave:function(anchorLink,index,slideIndex,direction){}});});
In order to create links to certain slides inside a section, you could do it in two ways:
If you are using fullPage.js with anchor links for the sections (using theanchors
option), then you will be able to use anchor links also to navigate directly to a certain slide inside a section.For example:http://alvarotrigo.com/fullPage/#secondPage/2
You can do it by using the index of the slide (starting by 0), or if you prefer, you can create custom anchor links for them by using the attributedata-anchor
in each slide. For example:
<divclass="section"><divclass="slide"data-anchor="slide1"> Slide 1</div><divclass="slide"data-anchor="slide2"> Slide 2</div><divclass="slide"data-anchor="slide3"> Slide 3</div><divclass="slide"data-anchor="slide4"> Slide 4</div></div>
Be careful!data-anchor
tags can not have the same value as any ID element on the site (or NAME element for IE).
class="toSlide"
data-index="3"
(or whatever slide number you want to link)
For example:
<spanclass="toSlide"data-index="3">Click here to go to slide 3</span>
To create links between sections, you could use themenu
option and make use of anchor links (#) as explained below in the options section.
verticalCentered
: (defaulttrue
) Vertically centering of the content within sections.resize
: (defaulttrue
) Whether you want to resize the text when the window is resized.scrollingSpeed
: (default700
) Speed in milliseconds for the scrolling transitions.sectionsColor
:(defaultnone
) Define the CSSbackground-color
property for each section:Example:
$('#fullpage').fullpage({sectionsColor:['#f2f2f2','#4BBFC3','#7BAABE','whitesmoke','#000'],});
anchors
: (default[]
) Defines the anchor links (#example) to be shown on the URL for each section. Using anchors forward and backward navigation will also be possible through the browser. This option also allows users to bookmark a specific section or slide.Be careful! if you use anchors, they can not have the same value as any ID element on the site (or NAME element for IE).
Important It is helpful to understand that the values in theanchors
option array correlate directly to the element with the class of.section
by it's position in the markup.
easing
: (defaulteaseInQuart
) Defines the transition effect to use for the vertical and horizontal scrolling.It requires the filevendors/jquery.easings.min.js
orjQuery UI for using some of its transitions. Other libraries could be used instead.loopTop
: (defaultfalse
) Defines whether scrolling up in the first section should scroll to the last one or not.loopBottom
: (defaultfalse
) Defines whether scrolling down in the last section should scroll to the first one or not.loopHorizontal
: (defaulttrue
) Defines whether horizontal sliders will loop after reaching the last or previous slide or not.css3
: (defaultfalse
). Defines wheter to use JavaScript or CSS3 transforms to scroll within sections and slides. Useful to speed up the movement in tablet and mobile devices with browsers supporting CSS3. If this option is set totrue
and the browser doesn't support CSS3, a jQuery fallback will be used instead.autoScrolling
: (defaulttrue
) Defines whether to use the "automatic" scrolling or the "normal" one. It also has affects the way the sections fit in the browser/device window in tablets and mobile phones.paddingTop
: (default0
) Defines the top padding for each section with a numerical value and its measure (paddingTop: '10px', paddingTop: '10em'...) Useful in case of using a fixed header.paddingBottom
: (default0
) Defines the bottom padding for each section with a numerical value and its measure (paddingBottom: '10px', paddingBottom: '10em'...). Useful in case of using a fixed footer.fixedElements
: (defaultnull
) Defines which elements will be taken off the scrolling structure of the plugin which is necesary when using thecss3
option to keep them fixed. It requires a string with the jQuery selectors for those elements. (For example:fixedElements: '#element1, .element2'
)normalScrollElements
: (defaultnull
) If you want to avoid the auto scroll when scrolling over some elements, this is the option you need to use. (useful for maps, scrolling divs etc.) It requires a string with the jQuery selectors for those elements. (For example:normalScrollElements: '#element1, .element2'
)normalScrollElementTouchThreshold
: (default5
) Defines the threshold for the number of hops up the html node tree Fullpage will test to see ifnormalScrollElements
is a match to allow scrolling functionality on divs on a touch device. (For example:normalScrollElementTouchThreshold: 3
)keyboardScrolling
: (defaulttrue
) Defines if the content can be navigated using the keyboardtouchSensitivity
: (default5
) Defines a percentage of the browsers window width/height, and how far a swipe must measure for navigating to the next section / slidecontinuousVertical
: (defaultfalse
) Defines whether scrolling down in the last section should scroll down to the first one or not, and if scrolling up in the first section should scroll up to the last one or not. Not compatible withloopTop
orloopBottom
.animateAnchor
: (defaulttrue
) Defines whether the load of the site when given an anchor (#) will scroll with animation to its destination or will directly load on the given section.menu
: (defaultfalse
) A selector can be used to specify the menu to link with the sections. This way the scrolling of the sections will activate the corresponding element in the menu using the classactive
.This won't generate a menu but will just add theactive
class to the element in the given menu with the corresponding anchor links.In order to link the elements of the menu with the sections, an HTML 5 data-tag (data-menuanchor
) will be needed to use with the same anchor links as used within the sections. Example:
<ulid="myMenu"><lidata-menuanchor="firstPage"class="active"><ahref="#firstPage">First section</a></li><lidata-menuanchor="secondPage"><ahref="#secondPage">Second section</a></li><lidata-menuanchor="thirdPage"><ahref="#thirdPage">Third section</a></li><lidata-menuanchor="fourthPage"><ahref="#fourthPage">Fourth section</a></li></ul>
$('#fullpage').fullpage({anchors:['firstPage','secondPage','thirdPage','fourthPage','lastPage'],menu:'#myMenu'});
Note: the menu element should be placed outside the fullpage wrapper in order to avoid problem when ussingcss3:true
. Otherwise it will be appeneded to thebody
by the plugin itself.
navigation
: (defaultfalse
) If set totrue
, it will show a navigation bar made up of small circles.navigationPosition
: (defaultnone
) It can be set toleft
orright
and defines which position the navigation bar will be shown (if using one).navigationTooltips
: (default []) Defines the tooltips to show for the navigation circles in case they are being used. Example:navigationTooltips: ['firstSlide', 'secondSlide']
.slidesNavigation
: (defaultfalse
) If set totrue
it will show a navigation bar made up of small circles for each landscape slider on the site.slidesNavPosition
: (defaultbottom
) Defines the position for the landscape navigation bar for sliders. Admitstop
andbottom
as values. You may want to modify the CSS styles to determine the distance from the top or bottom as well as any other style such as color.scrollOverflow
: (defaultfalse
) defines whether or not to create a scroll for the section in case its content is bigger than the height of it.In case of setting it totrue
, it requieres the vendor pluginjquery.slimscroll.min
and it should be loaded before the fullPage.js plugin. For example:
<scripttype="text/javascript"src="vendors/jquery.slimscroll.min.js"></script><scripttype="text/javascript"src="jquery.fullPage.js"></script>
sectionSelector
: (default.section
) Defines the jQuery selector used for the plugin sections. It might need to be changed sometimes to avoid problem with other plugins using the same selectors as fullpage.js..slideSelector
: (default.slide
) Defines the jQuery selector used for the plugin slides. It might need to be changed sometimes to avoid problem with other plugins using the same selectors as fullpage.js.
Scrolls one section up:
$.fn.fullpage.moveSectionUp();
Scrolls one section down:
$.fn.fullpage.moveSectionDown();
Scrolls the page to the given section and slide. The first slide, the visible one by default, will have index 0.
/*Scrolling to the section with the anchor link `firstSlide` and to the 2nd Slide */$.fn.fullpage.moveTo('firstSlide',2);
//Scrolling to the 3rd section in the site$.fn.fullpage.moveTo(3,0);//Which is the same as$.fn.fullpage.moveTo(3);
Scrolls the horizontal slider of the current section to the next slide:
$.fn.fullpage.moveSlideRight();
Scrolls the horizontal slider of the current section to the previous slide:
$.fn.fullpage.moveSlideLeft();
Sets the scrolling configuration in real time.Defines the way the page scrolling behaves. If it is set totrue
, it will use the "automatic" scrolling, otherwise, it will use the "manual" or "normal" scrolling of the site. Be careful when combining this option withscrollOverflow
set to true, as it might be difficult to scroll using the mouse wheel or the trackpad when the section is scrollable.
$.fn.fullpage.setAutoScrolling(false);
Adds or remove the possiblity of scrolling through sections by using the mouse wheel/trackpad or touch gestures (which is active by default).
$.fn.fullpage.setAllowScrolling(false);
Adds or remove the possiblity of scrolling through sections by using the keyboard arrow keys (which is active by default).
$.fn.fullpage.setKeyboardScrolling(false);
Defines the scrolling speed in milliseconds.
$.fn.fullpage.setScrollingSpeed(700);
Destroys the plugin events and optinally its HTML markup and styles.Ideal to use when using AJAX to load content. ()
type
: can be empty orall
. Ifall
is passed, the HTML markup and styles used by fullpage.js will be removed. This way the original HTML markup, the one used before any plugin modification is made, will be maintained.
//destroy any plugin event (scrolls, hashchange in the URL...)$.fn.fullpage.destroy();//destroy any plugin event and any plugin modification done over your original HTML markup.$.fn.fullpage.destroy('all');
Updates the DOM structure to fit the new window size or its contents.Ideal to use in convination with AJAX calls or external changes in the DOM structure of the site.
$.fn.fullpage.reBuild();
###afterLoad (anchorLink
,index
)Callback fired once the sections have been loaded, after the scrolling has ended.Parameters:
anchorLink
: anchorLink corresponding to the section.index
: index of the section. Starting from 1.
In case of not having anchorLinks defined in the plugin theindex
parameter would be the only one to use.
Example:
$('#fullpage').fullpage({anchors:['firstPage','secondPage','thirdPage','fourthPage','lastPage'],afterLoad:function(anchorLink,index){//using indexif(index=='3'){alert("Section 3 ended loading");}//using anchorLinkif(anchorLink=='secondSlide'){alert("Section 2 ended loading");}}});
###onLeave (index
,nextIndex
,direction
)This callback is fired once the user leaves a section, in the transition to the new section.
Parameters:
index
: index of the leaving section. Starting from 1.nextIndex
: index of the destination section. Starting from 1.direction
: it will take the valuesup
ordown
depending on the scrolling direction.
Example:
$('#fullpage').fullpage({onLeave:function(index,nextIndex,direction){//after leaving section 2if(index=='2'&&direction=='down'){alert("Going to section 3!");}elseif(index=='2'&&direction=='up'){alert("Going to section 1!");}}});
###afterRender()This callback is fired just after the structure of the page is generated. This is the callback you want to use to initialize other plugins or fire any code which requires the document to be ready (as this plugin modifies the DOM to create the resulting structure).
Example:
$('#fullpage').fullpage({afterRender:function(){alert("The resulting DOM stucture is ready");}});
###afterResize()This callback is fired after resizing the browser's window. Just after the sections are resized.
Example:
$('#fullpage').fullpage({afterResize:function(){alert("The sections have finished resizing");}});
###afterSlideLoad (anchorLink
,index
,slideAnchor
,slideIndex
)Callback fired once the slide of a section have been loaded, after the scrolling has ended.Parameters:
anchorLink
: anchorLink corresponding to the section.index
: index of the section. Starting from 1.slideAnchor
: anchor corresponding to the slide (in case there is)slideIndex
: index of the slide. Starting from 1. (the default slide doesn't count as slide, but as a section)
In case of not having anchorLinks defined for the slide or slides theslideIndex
parameter would be the only one to use.Example:
$('#fullpage').fullpage({anchors:['firstPage','secondPage','thirdPage','fourthPage','lastPage'],afterSlideLoad:function(anchorLink,index,slideAnchor,slideIndex){//first slide of the second sectionif(anchorLink=='secondPage'&&slideIndex==1){alert("First slide loaded");}//second slide of the second section (supposing #secondSlide is the//anchor for the second slideif(index==2&&slideIndex=='secondSlide'){alert("Second slide loaded");}}});
###onSlideLeave (anchorLink
,index
,slideIndex
,direction
)This callback is fired once the user leaves an slide to go to another, in the transition to the new slide.Parameters:
anchorLink
: anchorLink corresponding to the section.index
: index of the section. Starting from 1.slideIndex
: index of the slide.Starting from 0.direction
: takes the valuesright
orleft
depending on the scrolling direction.
Example:
$('#fullpage').fullpage({onSlideLeave:function(anchorLink,index,slideIndex,direction){//leaving the first slide of the 2nd Section to the rightif(index==2&&slideIndex==0&&direction=='right'){alert("Leaving the fist slide!!");}//leaving the 3rd slide of the 2nd Section to the leftif(index==2&&slideIndex==2&&direction=='left'){alert("Going to slide 2! ");}}});
If you want your page to be listed here. Pleasecontact me with the URL.
- http://www.britishairways.com/en-gb/information/travel-classes/experience-our-cabins
- http://www.sony-asia.com/microsite/mdr-10/
- https://www.xone.vodafone.com
- http://www.saltaboombox.com.ar
- http://snapzheimer.org/
- http://www.newjumoconcept.com/
- http://www.mi.com/shouhuan
- https://moneytree.jp/
- http://www.restaurantwoods.nl/
- http://charlotteaimes.com/
- http://collection.madeofsundays.com
- http://jacoberiksson.se/
- http://patuque.com/santateresa
- http://ymcadc.org/AnnualReport/
- http://rockercreative.com/
- http://lawinenstift.com/
- http://wtfdesign.pl/
- http://bnacademy.com.au/
- http://wantnova.com/
- http://usescribe.com/
- http://lucilecazanave.com/
- http://overallstudio.co.il/
- http://medlive.com
- http://therope.it/
- http://bearonunicycle.com/
- http://rawmilk.dk/en/
- http://www.carpetloverclub.net/
- http://www.implisit.com/
- http://www.batzaya.net/
- http://xepler.com/services
- http://www.graphicid.dk/
- http://hed.citinet.pro/
- http://www.jukstapoz.com/
- http://portfolio.io.utwente.nl/student/dijkavan/
- http://www.omqcomics.com/
- http://www.matrimonia.rs/
- http://www.jennbeaupre.com/jb/index.html
- http://mymattioli.it/
- http://www.carlphot.com/
- http://medissix.com/
- http://www.thefoodmovie.com/
- http://www.villareginateodolinda.it
- http://rodrigo.maroto.me
- http://www.gricnik.info/
- http://azul257.com.mx
- http://insomniapodcast.us
- http://acuity-prod.com/
- http://www.kesstrio.com
- http://willontheway.com/
- http://www.karmaffne.com/
- http://fossdistillery.is
- http://www.conversionculture.com/
- http://andreapaolucci.com/
- http://www.fergalkeenan.com
- http://spell-star.appspot.com/
- http://yizeng.me/
- http://rienpipe.es/
- http://neolearning.eu/
- http://sunfishlabs.com/
- http://unabridgedsoftware.com/
- http://wc2014.plnwrx.com/
- http://organice.io/
- http://alchemy-research.com/
- http://www.cima-ecuador.com/
- http://www.rienpipe.es
- http://atlanticcorp.us/
- http://bootstrap.tunerus.ru/nastroyka_pianino/
- http://moysport.ru/
- http://www.norttilaakso.fi/
- http://wcfixtures.co.uk/
- http://www.dopehustleinc.com/default.php
- http://themify.me/demo/#theme=fullpane
- http://bragdonfarm.com/
- http://www.paperdeermusic.com/
- http://vfwpost1.org/
- http://dancingroad.com
- http://www.camanihome.com/
Donations would be more than welcome :)
(The MIT License)
Copyright (c) 2013 Alvaro Trigo <alvaro@alvarotrigo.com>
Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the'Software'), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:
The above copyright notice and this permission notice shall beincluded in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANYCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
About
fullPage plugin by Alvaro Trigo. Create full screen pages fast and simple