Components
For our slides and templates, we’ve provided a wide range of ready-to-use components you can modify for your projects.
Sidebar
Click anywhere outside the element to close the sidebar. When the sidebar is on the screen, it blocks the ability to change slides.
To make a sidebar appear in the viewport, add a class sidebarTrigger on any element and data-sidebar-id="unique-id" for elements AND a sidebar to link them together.
<button class="sidebarTrigger" data-sidebar-id="unique-id">Sidebar</button>Here is the code for a simple sidebar:
<nav class="sidebar" data-sidebar-id="unique-id">
<div class="close"><svg><use href="assets/svg/icons.svg#close"></use></svg></div>
<div class="content">
<!-- content -->
</div>
</nav>Close Sidebar
To close the sidebar, add the close class to any element. Or add the class data-sidebar-action="close" attribute to any element in the opened sidebar:
<nav class="sidebar" data-sidebar-id="unique-id">
<div class="close"><svg><use href="assets/svg/icons.svg#close"></use></svg></div>
<div class="content">
<div data-sidebar-action="close">Close</div>
</div>
</nav>Position
Sidebar appears on right by default; add a class left to move it to the left.
Customize
You can change the width and background of a sidebar:
Hide Sidebar on Click
You can prevent the closing of the sidebar when the body is clicked by setting the following parameter after slides.js:
Animation
You can animate the contents of a sidebar by adding animated class on the sidebar element and ae-X for elements inside of it:
We’ve also created several different sidebar layouts you can choose from.
Popup
Popups display above everything else on the page. To trigger the appearance of a popup, add the class popupTrigger on any element you want and data-popup-id="unique-id" for the element AND a popup to link them together.
Use the code below to create popups:
For popups with the content centered, use this code:
Autoplay Video
You can enable autoplay of Youtube and Vimeo videos embedded with iframe by adding a autoplay class on the popup element:
Popup with autoplay video gallery
You can create a slider with videos inside your popup and play the video on the chosen slide. In this case, you don't need to add autoplay class on the popup element, but you should add it to each video inside your popup.
You can see this example in action here.
Close Popup
To close a popup, click on any element that includes the close class or by clicking on an element with the data-popup-action="close" class inside of the opened popup:
Hide on Click
Popups are used mainly to embed video content. By default, clicking on the empty or body area outside the video container will hide the video popup window. If you want to remove that ability, simply add a class popupContent on your content element:
Animate Popup
You can animate the contents of a popup by adding animated class on the popup element and ae-X for elements inside of it:
Focus on element in popup
If your popup has a <form>...</form> tag in it, you can focus on any focusable element (<input>, <textarea></textarea>, <select>) inside this form. To do that, add data-popup-focus-input="unique-input-id" to your popupTrigger and set this unique-input-id to the element inside <form>...</form> you'd like to focus on.
View all examples of popup usage here.
Slider
The slider we’ve included in Slides allows you to change images on slides by clicking on simple navigation indicators. A sample of a working slider is here. It’s possible to have multiple sliders on your page, but be careful to add unique IDs to each one.
Here’s the code for a slider and controller:
Add a class clickable on your slider element to change between various image elements on click.
You can use this slide as an example.
Arrows
You can add arrows to show the next or previous element of the Slider:
Here is an example.
Display slide number
You can add the total slide counter and display the current slide number. Just add an element with sliderCounter class and put in an element with class now for displaying the current slide number and element with class total to show the total number of slides:
Here is an example.
Swipeable
You can add a class swipeable on your slider element to swipe slides forward/backward with your touch screen or mouse.
Here is an example.
Autoplay
With the class autoplay on your slider element, your photos (or other elements) will advance in sequence automatically. The default slide-change interval is 5 seconds. Update the attribute data-slider-interval="5000" to change the default 5000 milliseconds interval time.
Autoplay video after changing slide
You can put a video inside your slider. If you will set autoplay class to the <iframe> or <video> tag this video will be played when its parent slide will be opened.
You can see it in action in this example.
AutoHeight
Add a autoHeight class on your slider element to manually set the correct height of the element each time you change the slider element. This way you can make a smooth animation between elements:
You can use this slide as an example.
Animated
You can animate the contents of a popup by adding animated class on the slider element and direction class for li elements inside of it:
You can use this slide as an example.
Dropdown
You can place the Slides share dropdown anywhere on a page, but we’ve used it mainly on top and bottom panels to include share capabilities on all slides.
To request the appearance of a dropdown use class dropdownTrigger with data-dropdown-id="unique-id" on your button or link.
Here is the dropdown code:
Position
Initially, the dropdown in Slides is positioned in the top left corner. You can change where the dropdown is located by adding right, center and bottom classes on a dropdown element.
Event
Initially, the dropdown in Slides is revealed on click. You can change it to hover by adding hover class on the dropdownTrigger element.
Share
We used the awesome Sharrre jQuery plugin to provide a suitable share window with a click. You can insert the text of your choice in your tweet with data-text="Place your message here". Add your URL with data-url="https://designmodo.com". For Pinterest, add your image with data-pinterest-image="http://path.to/your/image.jpg". For the email's subject and body add data-subject="Subject" and data-body="Body" on mail element:
Dialog
You can use dialog messages on your Slides projects for things like notifying users of new features, accepting cookies and inviting them to subscribe or communicate with site visitors.
First of all, you need to add <div class="dialogContainer"></div> to your page. All of your dialog windows will be added to this div.
Below is the code for a simple dialog message.
If you want your dialog to be shown with the animation when the page loaded, just add hidden class and data-dialog-action="open" attribute to a div with a dialog class
Position
You can change the position of the dialog message by adding left and/or bottom classes to the dialogContainer element.
Buttons
You have the option of adding up to three buttons to the bottom of your Dialog message. These buttons can have internal or external links, dialog actions, or even an email form.
Hidden Content
A dialog window can contain hidden parts of messages that can be revealed only on mouse hover. The code below shows how this is done.
Subscribe Form
You can also use a dialog as a subscribe form to acquire new users.
You can find working examples here:
Show Dialog
To show a dialog window make sure that it has a data-dialog-id="unique-id" attribute with unique value. Then add data-dialog-action="open" and data-dialog-id="unique-id" attributes to any element.
You can also open dialog with JS code. Just call the $('.dialog[data-dialog-id=unique-id]').slidesDialog('open');.
Close Dialog
You can hide the Dialog message in different ways:
By clicking on any element with
data-dialog-action="close"attribute located inside the dialog element.By clicking on any element with
data-dialog-action="close"anddata-dialog-action="close"attribute located outside the dialog element.Using JS code
$('.dialog[data-dialog-id=unique-id]').slidesDialog('close');.By adding
data-dialog-cookie-age="30"attribute to yourdialogelement. In this case, the dialog will be shown once and then will not be shown for 30 days.Setting a cookie with a name equals to
dialog-idattribute of a dialog. Just addonclick="$.cookie('unique-id',true,{expires:30,path:'/'});"to any element to set a cookie by clicking.
Open dialog with delay, and hide automatically.
You can open the dialog window in a few seconds after the page loads. To do so, add data-dialog-open-delay="1000" attribute to your dialog element.
You can also hide a dialog after a few seconds, to do so, add data-dialog-close-delay="3000" attribute to your dialog element.
The values are in ms, so 1000 equals a 1-second delay.
Create a Dialog message with JavaScript
You can create a dialog using just JavaScript and nothing else. Your dialog will be applied to the <div class="dialogContainer"></div> element. You can also see the full list of dialog options below:
Live examples you can find here.
Zoom Image
You can enlarge images on click as we did here. Just add data-action="zoom" attribute to your <img/> elements.
Buttons
You can find more button examples here. Also, other button types are shown below.
Play Buttons
Action Buttons
Fixed Width Containers
You can adjust the width of an element or container using the fix-X-12 classes. By default, these containers are centrally aligned. Add the toLeft class to align it left and toRight to align right.
Responsive Fixed Width Containers (added since Slides v.7)
You can also set the different maximum width of the container on different breakpoints.
Flex
Grid allows you to split the content into as many as 12 columns and lets you set a specific position for elements on a page. Use .flex or .inlineFlex (added since Slides v.7) class to enable grid-container behaviour. View all Flex Examples.
Responsive Horizontal Alignment (added since Slides v.7)
Change default start alignment inside flex columns on different screen sizes using classes .horizontal{Start|Center|End|Between|Around|Evenly}-{breakpoint} with the .flex element
Responsive Vertical Alignment (added since Slides v.7)
Change default stretch alignment inside flex columns on different screen sizes using classes .vertical{Start|Center|End|Baseline|Stretch}-{breakpoint} with the .flex element
Responsive Self-Vertical Alignment for single element (added since Slides v.7)
You can align single element vertically using .self{value}-{breakpoint} classes.
Responsive Flex Direction (added since Slides v.7)
Change the direction of elements inside the .flex container by adding dirRow-{breakpoint}, dirRowReverse-{breakpoint}, dirColumn-{breakpoint}, dirColumnReverse-{breakpoint}, reverse-{breakpoint} classes to it.
Column Spaces
The spaces between rows are relative to the width of the screen by default. If you want to make spaces fixed, just add a class fixedSpaces or noSpaces on flex element.
Responsive Columns
By default, columns will be converted to rows when the device screen width is less than 1024px. You can add the later class on the flex element, which will delay the switch from columns to rows until the screen size shrinks to less than 768px.
Also, you can use the following classes to layout your columns exactly like you want:
Height Equalizer
Very often, content from one column might be taller than in another, breaking visual symmetry. To prevent this, add a class equal on flex element and equalElement on each element you want to be even. This operation is managed by javascript and runs on load and resize.
By default, the height equalizer works on screens wider than 1024px. Add the later class to your equal element to make it work from 767px screens and wider. You can also define the exact breakpoint by adding the data-equal-collapse-width="X" attribute. In the end, you can add the equalMobile class to make elements equal on any screen size.
Fixed Width Containers in columns
Hold content in a fixed container inside flex columns using this code.
You can push your fixed container to a left or right side of a flex column by adding toLeft or toRight classes:
Reorder on resize
You can reorder columns for mobile devices to provide a better experience. Add class reverse on the flex element to reorder collapsed columns.
View all Flex Examples.
Sound
You can use an mp3 audio track as a part of your presentation of as background audio to set the right mood. Here is how you can make it:
You can use mp3 audio tracks as background audio to set the right mood in your slides. Here’s the code you need to add and control audio in Slides, including the speaker icon.
Class playing will be automatically added to an element with the same data-sound-id value as an audio track.
Contact Form
You can send and receive data from the contact form on Slide #55, Slide #157, Slide #163, and Slide #166 with AJAX (without page reloading). The form automatically sends this data to the ajax-email.php script which is located in the root folder of the Slides or Template you've downloaded from Template Generator. To make the script work, open the ajax-email.php file with any text editor and add your email which will enable you to receive messages from the form. You can also set the subject of an email. Note that this script will work only on a PHP server with SendMail installed.
PHP Script
Note: The PHP code included in Slides will forward form information to the email address you input only after you upload your site to your web hosting provider. By default, the PHP form code will not work on your local host server. Once your site is uploaded, the form’s submit button will function correctly.
Useful examples: MailChimp, Form Validation, and ReCaptcha.
Status Classes
You can customize your content using the following status classes, depending on various situations and specific requirements. Here are some classes you may find useful:
Using those status classes shown above, you can control any element or group of elements on your page. Here are some examples:
Responsive Control
You can easily hide or show any element on mobile device screens by adding the CSS classes shown below:
Typography
To speed up your coding process we've created a few classes to set your font family, weight, style, and size.
Font Family (added since Slides v.7)
Font styling
Font weight
Font Sizing
We've created scaling classes to easily change the font size. The base font size is 18px.
Also, this scaling model works with all the headings (H1-H6 HTML tags). All the classes are screen-size responsive, which means that the smaller screen you've got, the smaller heading will be. You don't need to set CSS font-size property using @media() query anymore!
You can also use direct font-size-X classes on any element to set its font-size:
These direct font-size-X classes also have a responsive versions:
See how it works in action here
Useful Classes
To simplify the flow and readability of your slides, we’ve created a list of classes that can speed up your coding and simplify customizing your code:
Material Icons
You can use Material Icons by Google on your Slides project. Simply replace existing icon names with desired ones from this page: https://material.io/icons/
Here is an example on how to use Material Icons in Slides buttons.
Last updated