Linking to Another Web Page
Contents:
1. HTML Markup Example
Actions are added to Slide Layers as the “data-actions” attribute, and are written in JavaScript Object format, as shown in the following example:
<!-- LAYER WITH LINK ACTION APPLIED -->
<div class="tp-caption tp-resizeme largewhitebg"
data-actions='[{
"event": "click",
"action": "simplelink",
"target": "_self",
"url": "http://www.themepunch.com"
}]'
data-frames='[{"delay": 0, "speed": 300, "from": "opacity: 0", "to": "opacity: 1"},
{"delay": "wait", "speed": 300, "to": "opacity: 0"}]'
data-x="right"
data-y="center"
data-hoffset="30"
data-voffset="-30"
data-width="['500']"
data-height="['auto']"
>Caption with Action</div><!-- END LAYER -->
2. Change Slides
2.1 Jump to a different Slide
To navigate to a specific slide, first add a “data-index” to the slide you wish to navigate to:
<!-- "data-index" added to the Slide to navigate to -->
<!-- In the following example, "rs" is the default prefix, and "2" represents "slide #2" -->
<li data-transition="fade" data-index="rs-2">
<!-- slide's main background image -->
<img src="assets/images/notgeneric_bg3.jpg" alt="Sky" class="rev-slidebg">
<!-- layers placed here -->
</li>
Then link to the other slide’s “data-index” in the Action’s “slide” setting (shown as “rs-2” in the example below).
- mouseenter
- mouseleave
- click
- jumptoslide
data-actions='[{
"event": "click",
"action": "jumptoslide",
"slide": "rs-2",
"delay": "0"
}]'
2.2 Navigate to the Next Slide
- mouseenter
- mouseleave
- click
- jumptoslide
- next
data-actions='[{
"event": "click",
"action": "jumptoslide",
"slide": "next",
"delay": "0"
}]'
2.3 Navigate to the Previous Slide
- mouseenter
- mouseleave
- click
- jumptoslide
- previous
data-actions='[{
"event": "click",
"action": "jumptoslide",
"slide": "previous",
"delay": "0"
}]'
3. Pause/Resume Slider Progress
- mouseenter
- mouseleave
- click
- pauseslider
- playslider
- toggleslider
data-actions='[{
"event": "click",
"action": "pauseslider",
"delay": "0"
}]'
Scroll Below Slider
Quick Tip
- mouseenter
- mouseleave
- click
- scrollbelow
data-actions='[{
"event": "click",
"action": "scrollbelow",
"offset": "50px"
"delay": "0"
}]'
5. Show/Hide Additional Layers
The Actions below allow for controlling another Layer’s visibility. To get started, first assign an ID attribute to the Layer you’d like to control. In the following example, the Layer’s ID is “slide-2-layer-1”.
<!-- BEGIN TEXT LAYER -->
<div class="tp-caption tp-resizeme largewhitebg" id="slide-2-layer-1"
data-frames='[{"delay": 500, "speed": 300, "from": "opacity: 0", "to": "opacity: 1"},
{"delay": "wait", "speed": 300, "to": "opacity: 0"}]'
data-x="center"
data-y="center"
data-hoffset="0"
data-voffset="0"
data-width="['auto']"
data-height="['auto']"
>Caption with ID Attribute</div>
<!-- END TEXT LAYER -->
Next, add the Action to your button:
- mouseenter
- mouseleave
- click
- startlayer
- stoplayer
- togglelayer
data-actions='[{
"event": "click",
"action": "startlayer",
"layer": "slide-1-layer-2",
"delay": "0"
}]'
And then adjust the animation delay parameters and also add the “data-lasttriggerstate” attribute to the Layer you’d like to control.
In the following example, the first “data-frames” Object represents the Layer’s “start” animation, with the second representing its “end” animation.
<div id="slide-2-layer-1"
class="tp-caption tp-resizeme largewhitebg"
data-frames='[{
"delay": "bytrigger",
"speed": 300,
"from": "opacity: 0",
"to": "opacity: 1"
}, {
"delay": "bytrigger",
"speed": 300,
"to": "opacity: 0"
}]'
data-lasttriggerstate="reset"
data-x="right"
data-y="center"
data-hoffset="30"
data-voffset="-30"
data-width="['500']"
data-height="['auto']"
>Caption Text</div><!-- END LAYER -->
6. Video/Audio
To control the current slide’s Background Video, enter “backgroundvideo” for the Action’s “layer” setting.
If the current Slide only contains one Video/Audio Layer, enter “firstvideo” for the Action’s “layer” setting.
Or enter the Layer div’s ID to control a specific Layer, as shown in the following examples:
<!-- VIDEO LAYER TO CONTROL -->
<div class="tp-caption tp-resizeme tp-videolayer" id="slide-1-layer-2"
<!-- AUDIO LAYER TO CONTROL -->
<div class="tp-caption tp-resizeme tp-audiolayer" id="slide-1-layer-2"
6.1 Play/Pause Media
- mouseenter
- mouseleave
- click
- playvideo
- pausevideo
- togglevideo
data-actions='[{
"event": "click",
"action": "playvideo",
"layer": "slide-1-layer-2",
"delay": "0"
}]'
6.2 Mute/Unmute Media
Quick Tip
- mouseenter
- mouseleave
- click
- mutevideo
- unmutevideo
- toggle_mute_video
- toggle_global_mute_video
data-actions='[{
"event": "click",
"action": "mutevideo",
"layer": "slide-1-layer-2",
"delay": "0"
}]'
7. Fullscreen
The Fullscreen Action can be used to dynamically change the slider’s Layout, expanding the slider to fill the browser’s window.
- mouseenter
- mouseleave
- click
- togglefullscreen
- gofullscreen
- exitfullscreen
data-actions='[{
"event": "click",
"action": "togglefullscreen",
"delay": "0"
}]'
8. Misc.
8.1 Call an external JavaScript function
- mouseenter
- mouseleave
- click
- callback
data-actions='[{
"event": "click",
"action": "callback",
"callback": "externalFunction()",
"delay": "0"
}]'
8.2 Simulate Click
If another Layer contains certain Actions, those Actions can be triggered from a separate Layer with the “simulateclick” Action.
- mouseenter
- mouseleave
- click
- simulateclick
data-actions='[{
"event": "click",
"action": "simulateclick",
"layer": "slide-1-layer-2",
"delay": "0"
}]'
8.3 Toggle any given Layer's class name
- mouseenter
- mouseleave
- click
- toggleclass
data-actions='[{
"event": "click",
"action": "toggleclass",
"layer": "slide-1-layer-1",
"classname": "some-class-name",
"delay": "0"
}]'
9. Example containing multiple Actions
The following Action combination could be applied to a “mute/unmute” button to control an Audio Layer, and then also toggle its own class for styling purposes.
data-actions='[{
"event": "click",
"action": "mutevideo",
"layer": "slide-1-layer-2",
"delay": "0"
}, {
"event": "click",
"action": "toggle_mute_video",
"layer": "slide-1-layer-1",
"classname": "mute-state-style",
"delay": "0"
}]'