js.scripts delay for slidetext

Support Forums Gris – HTML Template js.scripts delay for slidetext

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5453
    Artur
    Participant

    Is it possible to set for every single message an diffrent delay?

    For example:

    <div class=”messages”>
    <h2>We are creative people</h2> starts from beginning
    <h2>We love what we do</h2> starts with an custom delay like 5 sec. after the first one
    <h2>We build websites</h2> starts with an custom delay like 3 sec. after the second one

    We have eleven messages and need for every one an single delay. We found the delay in the “scripts” under line 117-119
    },2000 );
    },1000 );
    },2000 );
    But this are the general settings for the delay.

    Regrads
    Artur

    #5456
    CreaboxThemes
    Keymaster

    Hi,

    yes, that is possible. You have to make two changes.
    First, edit the function messageRotate(index) in the file scripts.js to this one:

    function messageRotate( index ) {
         var prev = ( (index == 0) ? (messageMax) : (index - 1) );
         var next = ( (index == messageMax) ? 0 : (index + 1 ) );
    
         setTimeout ( function () {
              $(messageArray[prev]).fadeOut();
              setTimeout ( function () {
                   $(messageArray[index]).fadeIn();
                   setTimeout ( function () {
                        messageRotate(next);
                   },$(messageArray[index]).data('time') );
              },1000 );
        },2000 );
    }

    Second, in your main file index.html, add the attribute data-time to each message in this way:

    <div class="messages">
         <h2 data-time="5000">We are <strong>creative</strong> people</h2>
         <h2 data-time="2000">We <strong>love</strong> what we do</h2>
         <h2 data-time="5000">We <strong>build</strong> websites</h2>
         ...
    </div>

    Regards

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.