Skip to content

Instantly share code, notes, and snippets.

@nextend
Last active January 5, 2018 09:13
Show Gist options
  • Save nextend/3c5ddca5bd0839dcece14e61cef83c24 to your computer and use it in GitHub Desktop.
Save nextend/3c5ddca5bd0839dcece14e61cef83c24 to your computer and use it in GitHub Desktop.
Hi, there is not such ready-to-use feature in Smart Slider, but you can do what you need.
You need to separate it into two task:
Task #1: On page load, scroll the browser to the slider with id 31:
<script type="text/javascript">
jQuery(window).on('ready', function() {
jQuery('html, body').scrollTop($('#n2-ss-31').offset().top);
});
</script>
Task #2: Force the slider with ID 31 to start with a specific slide:
Third slide:
<script type="text/javascript">
window['ss31'] = 2;
</script>
###Combined - you have the URL: http://test.com/index.php?SlideID=31&SliderID=5
<script type="text/javascript">
var urlVariables = (function getUrlVars() {
var vars = {};
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
vars[key] = value;
});
return vars;
})();
if (typeof urlVariables['SliderID'] !== 'undefined') {
jQuery(window).on('ready', function() {
jQuery('html, body').scrollTop($('#n2-ss-' + urlVariables['SliderID']).offset().top);
});
if (typeof urlVariables['SlideID'] !== 'undefined') {
window['ss' + urlVariables['SliderID']] = urlVariables['SlideID'];
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment