Function to call other slide


(haytham) #1

Hi there
I want to export my hype file in separate HTML files and I want t to use function to call slide from another slide,
the platform i will upload my files over it asked to use this funciton

function clipActionGotoSlide(pageIndex) { // implementation } 

else he asked to put this one on every page
function onSlideIndexChange(pageIndex){ var isiPad = navigator.userAgent.match(/iPad/i) != null; if (isiPad) { window.location = "onSlideIndexChange:" + pageIndex; } else { console.log("onSlideIndexChange:" + pageIndex); } } 

any advice to how to use it inside my hype file


#2

If you want to call this JavaScript function when you ‘exit’ a Hype scene, you could create a new JavaScript function ‘On Scene Unload’:

00 AM

And then insert it within the resulting JavaScript area. This Hype document (which runs this function) would need to be embedded as a normal div, not within an iframe.

You would likely just insert:

  function clipActionGotoSlide(pageIndex) { // implementation } 

    // else he asked to put this one on every page
    function onSlideIndexChange(pageIndex) {
      var isiPad = navigator.userAgent.match(/iPad/i) != null;
      if (isiPad) {
        window.location = "onSlideIndexChange:" + pageIndex;
      } else {
        console.log("onSlideIndexChange:" + pageIndex);
      }
    }

Can you explain a bit more about what you’re working with?


(haytham) #3

it is SIS server information system it is a platform like Veeva, and sorry I didn’t get the meaning of
This Hype document (which runs this function) would need to be embedded as a normal div, not within an iframe.


#4

Your Veeva-like platform likely allows embedding iframes, which is one way to embed your Hype document. If you embed your Hype document’s HTML page using that method, the function function clipActionGotoSlide(pageIndex) will be executed within the Hype frame and won’t be heard by the parent frame where the function actually is listening. So when you embed your Hype document, embed it by directly referencing the generated JavaScript file. That embed code looks like this:

 <div id="document_hype_container" style="margin:auto;position:relative;width:600px;height:400px;overflow:hidden;">
	<script type="text/javascript" charset="utf-8" src="document.hyperesources/document_hype_generated_script.js?34349"></script>
</div>

(haytham) #5

You mean to write this code on every HTML page I exported from my hype file, and if that where to add my function, I am sorry but it is still very un-understand :blush:
can you please give me a hype file has 2 slides using this function, I appreciated your effort


(haytham) #6

else there is in their doucument i can use this function
window.open = function(url) { window.location = url; };
does it help :slight_smile: ?