jquery - How to anchor to the bottom of the page while switching to the right video in a carousel? -


i have carousel @ bottom of page 3 youtube videos. there twitter button share individual video.

when click on twitter button, link like: http://yoursite.com/index.html#video-1

so link point bottom of page. however, trying figure out pseudo code , logic point bottom of page , rotate correct video.

at moment, http://yoursite.com/index.html#video-1 http://yoursite.com/index.html#video-2 http://yoursite.com/index.html#video-3

will point #video-1

i have figured out.

essentially, string detection in url , solve problem.

    // check url given # anchor string if(document.url.indexof("buying-a-car") != -1) {     $("#ytvideo"+1).show();        } else if(document.url.indexof("taking-a-holiday") != -1){     $("#ytvideo"+2).show();       } else if(document.url.indexof("moving-to-new-zealand") != -1){     $("#ytvideo"+3).show();       } else if(document.url.indexof("selling-your-house") != -1){     $("#ytvideo"+4).show();       } else{     $("#ytvideo"+1).show();      } 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -