-
-
Save dimsemenov/7ab69f4011d03f983b3e40204029f532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add to your theme functions.php | |
// | |
// Moves slider to the root element of the page when fullscreen is entered, | |
// and back to the original position when fullscreen is exit. | |
function add_additional_rs_code() { | |
?> | |
var sliderEl = $('.royalSlider'); | |
var sliderInstance = sliderEl.data('royalSlider'); | |
var parentEl; | |
sliderInstance.ev.on('rsEnterFullscreen', function() { | |
if (!parentEl) { | |
parentEl = sliderEl.parent(); | |
} | |
$('body').append(sliderEl); | |
}); | |
sliderInstance.ev.on('rsExitFullscreen', function() { | |
if (parentEl) { | |
parentEl.append(sliderEl); | |
} | |
}); | |
<?php | |
} | |
add_action('new_rs_after_js_init_code', 'add_additional_rs_code'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesnt work