Direct URL to Specific Slide
I am using a slider called mySlider, or SL_Slider..
It uses the MooTools library...
If i am on the page with the slider, there is a simple script for the href that calls the appropriate slide..
<a href="javascript:mySlider.numPress(3);">link</a>
I believe this script is supposed to have the ability to also allow for a specific slide to load if the page in question is accessed via a URL link (from another page). There is a function that looks to be looking for a "passedID" variable (pasted below).
My problem is that i can't seem to figure out how to pass this variable to the script via a URL (or even if that's possible)...
I've tried all sort of combos and no luck...
Here is an example I tried (plus a ton of others): www.website.com?passedID=3
Any help would be much appreciated!
(If there is any additional info required, i am happy to paste it.
Thanks.
Mac
slideIt: function(passedID) {
var self = this;
//get item to slide out
var curItem = self.options.items[self.options.itemNum];
if(self.options.numNavActive == true){
var curNumItem = self.numNav[self.options.itemNum];
}
//check for passedID presence
if(passedID != null) {
if(self.options开发者_JAVA百科.itemNum != passedID){
if(self.options.itemNum > passedID) {
self.direction = 0;
} else {
self.direction = 1;
}
self.options.itemNum = passedID;
}
}
else{
self.changeIndex();
}
var slide_num_in_url = document.location.hash.split("#").join("");
mySlider.numPress(slide_num_in_url);
EDIT:
Call when the page loads.
window.onload = function()
{
var slide_num_in_url = document.location.hash.split("#").join("");
mySlider.numPress(slide_num_in_url);
}
精彩评论