Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #33592

Re: timeline

Newsgroups comp.lang.javascript
Subject Re: timeline
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <D_6dndl-zu23-u3EnZ2dnUU7-V3NnZ2d@westnet.com.au>
Date 2017-07-20 10:26 +0200
Message-ID <XnsA7B86A488E7BFeejj99@194.109.6.166> (permalink)

Show all headers | View raw


Andrew Poulos <ap_prog@hotmail.com> wrote on 20 Jul 2017 in 
comp.lang.javascript:

> I'm working on an elearning course which displays one "page" of content 
> at a time to the user. Each page includes the same sort of items:. 
> image, text, more text, audio...
> 
> The items get displayed in sequence with various transition effects eg. 
> an image fades in, text slides in from the right...
> 
> What I'm finding is that some content is heavier than other content and 
> so an item may display earlier/later than it should. To workaround that 
> I've started putting in calls to trigger the next display eg. display 
> the image when the fade in has completed display the text... rather than 
> to rely on timeouts.
> 
> This is ok but it's become tedious tracking stuff from within the code 
> that does the transition.
> 
> What I'm thinking might be a better approach is to have a "timeline" 
> where there's a series of functions that get triggered by some "control" 
> code. So I would have a timeline that looks like
> 
> var timeline = ["a", "b", "c",...];
> 
> where "a" "b" are the names of the functions to call and control code 
> that looks like
> 
> var position = 0;
> 
> function runTimeline() {
>    position = (position == timeline.length ? position : 0);
>    window.timeline[position]();
>    position++;
>}
> 
> function a() {
>    // do stuff and then when done
>    runTimeline();
>}
> function b() {
>    // do stuff and then when done
>    runTimeline();
>}
> 
> Is that a workable approach or is there a better/smarter way?

The smart way is to have real or virtual distinct html-pages,
and do the job with serverside code, methinks.

You can include the common part of the code with serverside includes,
or make virtual pages using a 404-page server.transfer and more.

You can still use javascript, using a windows server,
if only to stay on topic here with such serverside code.


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

timeline Andrew Poulos <ap_prog@hotmail.com> - 2017-07-20 18:17 +1000
  Re: timeline "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-20 10:26 +0200
  Re: timeline Wally W. <ww84wa@aim.com> - 2017-07-20 08:37 -0400
    Re: timeline Andrew Poulos <ap_prog@hotmail.com> - 2017-07-21 07:47 +1000
      Re: timeline Wally W. <ww84wa@aim.com> - 2017-07-20 23:04 -0400
        Re: timeline Andrew Poulos <ap_prog@hotmail.com> - 2017-07-21 16:08 +1000
          Re: timeline "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-21 11:36 +0200
            Re: timeline Julio Di Egidio <julio@diegidio.name> - 2017-07-21 08:50 -0700
              Re: timeline "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-22 00:03 +0200
            Re: timeline Andrew Poulos <ap_prog@hotmail.com> - 2017-07-22 15:00 +1000
              Re: timeline "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-22 10:19 +0200
                Re: timeline Andrew Poulos <ap_prog@hotmail.com> - 2017-07-23 09:08 +1000
                Re: timeline "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-23 10:15 +0200
  Re: timeline "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-07-20 05:56 -0700
    Re: timeline Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-23 19:07 +0200
  Re: timeline Julio Di Egidio <julio@diegidio.name> - 2017-07-20 05:59 -0700
  Re: timeline Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-23 18:57 +0200
    Re: timeline Julio Di Egidio <julio@diegidio.name> - 2017-07-23 10:33 -0700

csiph-web