/
githubmirror
/
fullPage.js
Обзор
Документация
Войти
/
githubmirror
/
fullPage.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/callbacks.html
298 строк
10 KB
Alvaro Trigo López
- Updating examples with link to RTL example
15 дек 2025, 20:23
15 дек 2025, 20:23
c4bc2fb
Код
Авторство
О чём код?
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Callback functions version 3 - fullPage.js</title> <meta name="author" content="Alvaro Trigo Lopez" /> <meta name="description" content="fullPage callback function." /> <meta name="keywords" content="fullpage,jquery,demo,callback,function,event" /> <meta name="Resource-type" content="Document" /> <link rel="stylesheet" type="text/css" href="../dist/fullpage.css" /> <link rel="stylesheet" type="text/css" href="examples.css" /> <!--[if IE]> <script type="text/javascript"> var console = { log: function() {} }; </script> <![endif]--> <style> #callbacksDiv p{ font-size:1.2em; } #callbacksDiv h4{ font-size: 1.4em; font-weight: bold; color: white; text-decoration: underline; } .box{ margin: 7em 0; } </style> </head> <body> <div style="position:fixed;top:50px;left:50px;color:white;z-index:999;" id="callbacksDiv"></div> <ul id="menu"> <li data-menuanchor="firstPage"><a href="#firstPage">First slide</a></li> <li data-menuanchor="secondPage"><a href="#secondPage">Second slide</a></li> <li data-menuanchor="3rdPage"><a href="#3rdPage">Third slide</a></li> </ul> <select id="demosMenu"> <option selected>Choose Demo</option> <option id="simple">Simple</option> <option id="custom-arrows">Custom arrows</option> <option id="hide-sections">Hide sections</option> <option id="scroll-after-fullpage">Scroll after fullpage</option> <option id="observer">Observer</option> <option id="jquery-adapter">jQuery adapter</option> <option id="active-slide">Active section and slide</option> <option id="auto-height">Auto height</option> <option id="autoplay-video-and-audio">Autoplay Video and Audio</option> <option id="backgrounds">Background images</option> <option id="backgrounds-fixed">Fixed fullscreen backgrounds</option> <option id="background-video">Background video</option> <option id="callbacks">Callbacks</option> <option id="continuous-horizontal">Continuous horizontal (premium)</option> <option id="continuous-vertical">Continuous vertical</option> <option id="parallax">Parallax (premium)</option> <option id="cards">Cards 3d (premium)</option> <option id="water-effect">Water effect (premium)</option> <option id="drop-effect">Drop effect (premium)</option> <option id="css3">CSS3</option> <option id="drag-and-move">Drag And Move (premium)</option> <option id="easing-css3">Easing CSS</option> <option id="easing-js">Easing JS</option> <option id="fading-effect">Fading Effect (premium)</option> <option id="fixed-headers">Fixed headers</option> <option id="gradient-backgrounds">Gradient backgrounds</option> <option id="interlocked-slides">Interlocked Slides (premium)</option> <option id="looping">Looping</option> <option id="methods">Methods</option> <option id="navigation-vertical">Vertical navigation dots</option> <option id="navigation-horizontal">Horizontal navigation dots</option> <option id="navigation-tooltips">Navigation tooltips</option> <option id="no-anchor">No anchor links</option> <option id="normal-scroll">Normal scrolling</option> <option id="normalScrollElements">Normal scroll elements</option> <option id="offset-sections">Offset sections (premium)</option> <option id="one-section">One single section</option> <option id="reset-sliders">Reset sliders (premium)</option> <option id="responsive-auto-height">Responsive Auto Height</option> <option id="responsive-height">Responsive Height</option> <option id="responsive-width">Responsive Width</option> <option id="responsive-slides">Responsive Slides (premium)</option> <option id="scrollBar">Scroll bar enabled</option> <option id="scroll-horizontally">Scroll horizontally (premium)</option> <option id="scrollOverflow">Scroll inside sections and slides</option> <option id="scrollOverflow-reset">ScrollOverflow Reset (premium)</option> <option id="lazy-load">Lazy load</option> <option id="scrolling-speed">Scrolling speed</option> <option id="rtl">RTL</option> <option id="trigger-animations">Trigger animations</option> <option id="vue-fullpage">Vue component</option> <option id="react-fullpage">React component</option> <option id="angular-fullpage">Angular component</option> </select> <div id="fullpage"> <div class="section " id="section0"> <h1>fullPage.js</h1> <p>Callbacks!</p> </div> <div class="section" id="section1"> <div class="slide"> <div class="intro"> <h1>Feel free</h1> <p>All the callbacks you need to do whatever you need.</p> <p>Just what you would expect.</p> </div> </div> <div class="slide"> <h1>Slide 2</h1> </div> </div> <div class="section" id="section2"> <div class="intro"> <div class="box"> <h1>Ideal for animations</h1> <p>Total control over your website.</p> </div> <div class="box"> <h1>Ideal for animations</h1> <p>Total control over your website.</p> </div> <div class="box"> <h1>Ideal for animations</h1> <p>Total control over your website.</p> </div> <div class="box"> <h1>Ideal for animations</h1> <p>Total control over your website.</p> </div> <div class="box"> <h1>Ideal for animations</h1> <p>Total control over your website.</p> </div> <div class="box"> <h1>Ideal for animations</h1> <p>Total control over your website.</p> </div> </div> </div> </div> <script type="text/javascript" src="../dist/fullpage.js"></script> <script type="text/javascript" src="examples.js"></script> <script type="text/javascript"> var deleteLog = false; //adding the params info into the page function addToLog(callbackName, params){ var callbackData = '<h4>' + callbackName + '</h4>'; Object.keys(params).forEach(function(key){ var content = params[key]; if(content !== null && typeof content === 'object'){ content = JSON.stringify(content); } callbackData += '<p><b>' + key + '</b>: ' + content + '</p>'; }); callbackData += '<br />'; document.getElementById('callbacksDiv').innerHTML += callbackData; } //fullpage initialisation var myFullpage = new fullpage('#fullpage', { sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'], anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'], menu: '#menu', beforeLeave: function(origin, destination, direction, trigger){ var params = { origin: origin, destination:destination, direction: direction, trigger: trigger }; //clearing the logging in the screen if(deleteLog){ document.getElementById('callbacksDiv').innerHTML = ''; } addToLog('beforeLeave', params); console.log("--- beforeLeave ---"); console.log(params); }, onLeave: function(origin, destination, direction, trigger){ var params = { origin: origin, destination:destination, direction: direction, trigger: trigger }; addToLog('onLeave', params); console.log("--- onLeave ---"); console.log(params); }, onSlideLeave: function(section, origin, destination, direction, trigger){ var params = { section: section, origin: origin, destination: destination, direction: direction, trigger: trigger }; //clearing the logging in the screen if(deleteLog){ document.getElementById('callbacksDiv').innerHTML = ''; } addToLog('onSlideLeave', params); console.log("--- onSlideLeave ---"); console.log(params); }, afterRender: function(){ addToLog('afterRender', {}); console.log("afterRender"); }, afterResize: function(width, height){ addToLog('afterResize', { width: width, height: height }); console.log("afterResize"); console.log(params); }, afterSlideLoad: function(section, origin, destination, direction, trigger){ var params = { section: section, origin: origin, destination: destination, direction: direction, trigger: trigger }; addToLog('afterSlideLoad', params); console.log("--- afterSlideLoad ---"); console.log(params); console.log("----------------"); deleteLog = true; }, afterLoad: function(origin, destination, direction, trigger){ var params = { origin: origin, destination: destination, direction: direction, trigger: trigger }; addToLog('afterLoad', params); console.log("--- afterLoad ---"); console.log(this); console.log('==============='); deleteLog = true; }, onScrollOverflow: function(section, slide, position, direction){ var params = { section: section, slide: slide, position: position, direction: direction }; console.log("--- onScrollOverflow ---"); console.log(params); if(deleteLog){ document.getElementById('callbacksDiv').innerHTML = ''; } addToLog('onScrollOverflow', params); deleteLog = true; } }); </script> </body> </html>