JS

JavaScript is a programming language that allows for dynamic and interactive web experiences. Learn how you can customize the behavior of Slides' pages to meet specific needs and preferences.

Options

There are a few variables that you can change in the js/slides.js file to customize your page. Here is the full list with the default values:

// Debugging flag (all events except scrolling logged in the browser console)
window.debug = window.debug ? window.debug : 0;
if(window.location.href.indexOf("slidesDebug")!=-1){window.debug = 1;}
// Debugging flag (only scrolling/slide change events logged in the browser console)
window.scrollDebug = window.scrollDebug ? window.scrollDebug : 0;
if(window.location.href.indexOf("slidesScrollDebug")!=-1){window.scrollDebug = 1;}
// Flag indicating whether an action is currently in progress
window.inAction = 1;
// Flag indicating whether slide change is allowed
window.allowSlide = 1;
// Flag indicating whether regular scrolling is blocked
window.blockScroll = 1;
// Offset for the slide effect (ms)
window.effectOffset = 500;
// Speed of the slide effect (ms)
window.effectSpeed = 1000;
// Speed of the slide animation (ms)
window.slideSpeed = 1000;
// Delay for element animation classes clean up after the slide effect (ms)
window.cleanupDelay = 1400;
// If set, effectSpeed, effectOffset, slideSpeed, cleanupDelay will be detected from CSS classes, not from JS code
window.setAnimFromCSS = 1;
// Flag indicating whether the horizontal mode is enabled (slide effects only)
window.horizontalMode = 0;
// Progress of loading (0.5 = 50% loaded)
window.loadingProgress = 0;
// Flag indicating whether smooth scrolling is enabled
window.smoothScroll = 0;
// Speed of smooth scrolling
window.scrollSpeed = 500;
// Flag indicating whether sticky scroll effect is enabled
window.stickyScroll = 0;
// Speed of the sticky scroll effect
window.stickyScrollEffectSpeed = 500;
// Flag indicating whether scroll collection is enabled
window.collectScrolls = 0;
// Flag indicating whether preload is enabled
window.preload = 1;
// Flag indicating whether setting hash link is enabled (page.html#slide)
window.setHashLink = 1;
// Flag indicating whether the sidebar is shown now
window.sidebarShown = 0;
// Flag indicating whether the sidebar should be hidden on the body click
window.hideSidebarOnBodyClick = 1;
// Flag indicating whether popup should be hidden on body click
window.hidePopupOnBodyClick = 1;
// Add the status of the slider as a class on the body (slider_name, slider_name_0); 
window.sliderStatus = 0;
// Scroll sensitivity for slide change. The larger value will force user to make larger motion on touchpad / scroll more mousewheel steps.
window.minScrollToSlide = 200; // Default - for PC mousewheel, mostly
if(window.isAndroid){window.minScrollToSlide = 50;} // For Android touchscreens
if(window.isSafari && window.isMobile){window.minScrollToSlide = 70;} // For iPhone touchscreens
// Timeout to prevent the immediate change of a slide with a scrollable content in it when the end of the content is reached
window.awaitToSlideDown = 300;
// Pass the width of a frame as this var if you include this page into another one as an iframe. 
// Do that from the parent page like this: $("#iframe").get(0).contentWindow.frameWidthToDetectZoom = $("#iframe").width();
//window.frameWidthToDetectZoom = 1234;
// Sensitivity for hiding elements on scroll
window.hideOnScrollSensitivity = 100;
// Flag indicating whether parallax is enabled on mobile devices
window.allowParallaxOnMobile = 1;
// Flag indicating whether key navigation is disabled
window.disableKeyNavigation = 0;

Events

There are few callbacks that allow you to execute your custom code after some events on your page:

Need more events for your development purposes? Please, let us knowarrow-up-right!

Methods

You can use these javascript functions to manipulate your slides page:

Debug mode

You can switch your page into development mode and check in the browser console (⌘|Ctrl + Shift + I) which functions are called in the different moments.

You can enter the debug mode in four different ways:

  • Add <script> window.debug = 1; </script> right after js/slides.js or js/slides.min.js script;

  • Add #slidesDebug to the end of your page URL;

  • Add ?slidesDebug=1 to your page URL;

  • Set cookie with name slidesDebug and any value for your page. Type in the browser console: $.cookie("slidesDebug",true); to do that.

Then open the browser console and reload your page.

Scroll debug mode (added since Slides v.7)

The debug mode does not log scroll/slide change events. To enable logging of these events, use slidesScrollDebug instead of slidesDebug as mentioned in the debug mode section.

Last updated