I would like to target a video on another website in my Storyline course and would like to have the video centered in my SL page. Can anyone offer the iframe instructions to do this? For example, the video is ___ pixels from the top and ___ pixels from the left of the page. I want the video to appear in the center of the SL page without the user having to scroll down to it. I've seen these instructions in the past but haven't been successful finding them.
Does the video element in the webpage have an ID? You might be able to run a JavaScript function to locate it and scroll the window. Something like.... (untested)
function myFunction() { var elmnt = document.getElementById("content"); elmnt.scrollIntoView(); };
I don't see an ID for the video. It's located on a web page and I was hoping to have it centered in the slide window. I was thinking that someone had posted how to do this a few years ago. Thanks for your suggestion.
I'm going to post this here Lu so I can find it and try it later: var myIframe = document.getElementById('iframe'); myIframe.onload = function () { myIframe.contentWindow.scrollTo(xcoord,ycoord); };
3 Replies
Does the video element in the webpage have an ID? You might be able to run a JavaScript function to locate it and scroll the window.
Something like.... (untested)
function myFunction() {
var elmnt = document.getElementById("content");
elmnt.scrollIntoView();
};
I don't see an ID for the video. It's located on a web page and I was hoping to have it centered in the slide window. I was thinking that someone had posted how to do this a few years ago. Thanks for your suggestion.
I'm going to post this here Lu so I can find it and try it later:
var myIframe = document.getElementById('iframe');
myIframe.onload = function () {
myIframe.contentWindow.scrollTo(xcoord,ycoord);
};
Might run into a "same domain" issue but there appear to be some workarounds.
https://stackoverflow.com/questions/1192228/scrolling-an-iframe-with-javascript
This discussion is closed. You can start a new discussion or contact Articulate Support.