I'm trying to trigger the 'Box Roll' header function when the video background ends.
So far, using JS, I'm able to successfully detect the end of the video, ready to trigger the box roll effect, but I'm unable to actually find the function to make it happen.
Here's what I have so far:
document.getElementsByClassName("nectar-video-bg")[0].setAttribute("id", "home-vid-boxroll"); //this gives the video bg an ID
document.getElementsByClassName("nectar-video-bg")[0].removeAttribute("loop"); //this removes the loop attribute, so we can detect the end of video
var vid = document.getElementById("home-vid-boxroll"); vid.onended = function() {
//INSERT JS HERE to trigger the box roll
};
Can anyone help me out with the appropriate Box Roll function I need to insert?
I've actually figured it out myself by adding in a simulated click on the arrow down button, triggered when the video ends (see below), but how about you guys consider building this functionality into a release? The Box-Roll effect is really nice, but it seems that it could be so much better with just 2 small additions in the Page Header Settings:
Have a toggle for 'Loop' on the Video Background
Have a toggle for 'trigger the box roll on video end' (when video background + box-roll is used)
Anyway, to trigger the Box Roll effect when the Video Background ends, I used the following JS and jQuery:
//add an ID to the video bg - needed to detect the end of the video document.getElementsByClassName("nectar-video-bg")[0].setAttribute("id", "home-vid-boxroll");
//remove the Loop attribute from the video tag - needed to detect the end of the video document.getElementsByClassName("nectar-video-bg")[0].removeAttribute("loop");
var vid = document.getElementById("home-vid-boxroll");
//detect the end of the video vid.onended = function() {
//simulate a click on the down arrow, to trigger the Box Roll jQuery(".section-down-arrow").click()
I'm trying to trigger the 'Box Roll' header function when the video background ends.
So far, using JS, I'm able to successfully detect the end of the video, ready to trigger the box roll effect, but I'm unable to actually find the function to make it happen.
Here's what I have so far:
document.getElementsByClassName("nectar-video-bg")[0].setAttribute("id", "home-vid-boxroll"); //this gives the video bg an ID
document.getElementsByClassName("nectar-video-bg")[0].removeAttribute("loop"); //this removes the loop attribute, so we can detect the end of video
var vid = document.getElementById("home-vid-boxroll");
vid.onended = function() {
//INSERT JS HERE to trigger the box roll
};
Can anyone help me out with the appropriate Box Roll function I need to insert?
Hey Again,
Please consider hiring a freelancer over at Envato Studio for these Theme customizations as they are not provided as Support: http://themeforest.net/page/item_support_policy .
Thanks
ThemeNectar Support Team
OK, thanks Tahir, I understand.
I've actually figured it out myself by adding in a simulated click on the arrow down button, triggered when the video ends (see below), but how about you guys consider building this functionality into a release? The Box-Roll effect is really nice, but it seems that it could be so much better with just 2 small additions in the Page Header Settings:
Anyway, to trigger the Box Roll effect when the Video Background ends, I used the following JS and jQuery:
//add an ID to the video bg - needed to detect the end of the video
document.getElementsByClassName("nectar-video-bg")[0].setAttribute("id", "home-vid-boxroll");
//remove the Loop attribute from the video tag - needed to detect the end of the video
document.getElementsByClassName("nectar-video-bg")[0].removeAttribute("loop");
var vid = document.getElementById("home-vid-boxroll");
//detect the end of the video
vid.onended = function() {
//simulate a click on the down arrow, to trigger the Box Roll
jQuery(".section-down-arrow").click()
};
Glad you got it sorted. Will add it to the Wishlist .
Best
ThemeNectar Support Team