change class dinamically to the pass of a videotimePassing data to components in vue.jsPassing event and argument to v-on in Vue.jsHow to pass a parameter to Vue @clickThe width of columns in a table change when a row of input boxes is added dinamicallyVue.js pass props to dynamicly change component classHow to dinamically make computed in Vue.js, under dynamically loaded datachange class depend on string valuesVue.js Firestore Fill select dynamicallyPassing multiple properties in vuejs witch class

How much can I judge a company based on a phone screening?

What is the difference between 王 and 皇?

Do I have to cite common CS algorithms?

Why did IBM make public the PC BIOS source code?

Why did Saruman lie?

Is there a way to encourage or even force airlines and booking engines to show options with overnight layovers?

If "more guns less crime", how do gun advocates explain that the EU has less crime than the US?

Scam? Phone call from "Department of Social Security" asking me to call back

Boss asked a co-worker to assault me

How would you translate this? バタコチーズライス

What is a "soap"?

What is the farthest a camera can see?

Boss wants me to ignore a software API license prohibiting mass download

How should I write this passage to make it the most readable?

Does EU compensation apply to flights where the departure airport closes check-in counters during protests?

Escape Velocity - Won't the orbital path just become larger with higher initial velocity?

Who invented Monoid?

Will using a resistor in series with a LED to control its voltage increase the total energy expenditure?

Does fossil fuels use since 1990 account for half of all the fossil fuels used in history?

Running code generated in realtime in JavaScript with eval()

Graphs for which a calculus student can reasonably compute the arclength

Submitting a new paper just after another was accepted by the same journal

Can lodestones be used to magnetize crude iron weapons?

Tempoverlustspiel



change class dinamically to the pass of a videotime


Passing data to components in vue.jsPassing event and argument to v-on in Vue.jsHow to pass a parameter to Vue @clickThe width of columns in a table change when a row of input boxes is added dinamicallyVue.js pass props to dynamicly change component classHow to dinamically make computed in Vue.js, under dynamically loaded datachange class depend on string valuesVue.js Firestore Fill select dynamicallyPassing multiple properties in vuejs witch class






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















i need to change the class of some span to the pass of the time of a video. i create the span tags from an array with the v-for, inside the array i have the start time and stop time of the text, so i want to change the class of the single text checking the interval and the actual video time. i tried this code:



```

<span :class="'selected':(item.id===currentIndex)" v-for="item in Array">
item.text
</span>


data()
return
Array: [
id: 0,
start_time: 0,
end_time: 1,
text: "Hello"
,
id: 1,
start_time: 1,
end_time: 2,
text: "guys."
,
id: 2,
start_time: 2,
end_time: 3,
text: "In this lesson"
, ...]
,
currentIndex:'',


setInterval(myTimer, 500);

function myTimer()
for (let i in array)
if (Math.round(_myplayer.currentTime()) != 0)
if (array[i].start_time < Math.round(_myplayer.currentTime()) && Math.round(_myplayer.currentTime()) <= array[i].end_time)
this.currentIndex=i;




```


these are the main pieces of my code, the main problem is to link the currentIndex to the id of the span. it's a kind of ted transcript text highlight
sorry for my english, thank you










share|improve this question
































    0















    i need to change the class of some span to the pass of the time of a video. i create the span tags from an array with the v-for, inside the array i have the start time and stop time of the text, so i want to change the class of the single text checking the interval and the actual video time. i tried this code:



    ```

    <span :class="'selected':(item.id===currentIndex)" v-for="item in Array">
    item.text
    </span>


    data()
    return
    Array: [
    id: 0,
    start_time: 0,
    end_time: 1,
    text: "Hello"
    ,
    id: 1,
    start_time: 1,
    end_time: 2,
    text: "guys."
    ,
    id: 2,
    start_time: 2,
    end_time: 3,
    text: "In this lesson"
    , ...]
    ,
    currentIndex:'',


    setInterval(myTimer, 500);

    function myTimer()
    for (let i in array)
    if (Math.round(_myplayer.currentTime()) != 0)
    if (array[i].start_time < Math.round(_myplayer.currentTime()) && Math.round(_myplayer.currentTime()) <= array[i].end_time)
    this.currentIndex=i;




    ```


    these are the main pieces of my code, the main problem is to link the currentIndex to the id of the span. it's a kind of ted transcript text highlight
    sorry for my english, thank you










    share|improve this question




























      0












      0








      0








      i need to change the class of some span to the pass of the time of a video. i create the span tags from an array with the v-for, inside the array i have the start time and stop time of the text, so i want to change the class of the single text checking the interval and the actual video time. i tried this code:



      ```

      <span :class="'selected':(item.id===currentIndex)" v-for="item in Array">
      item.text
      </span>


      data()
      return
      Array: [
      id: 0,
      start_time: 0,
      end_time: 1,
      text: "Hello"
      ,
      id: 1,
      start_time: 1,
      end_time: 2,
      text: "guys."
      ,
      id: 2,
      start_time: 2,
      end_time: 3,
      text: "In this lesson"
      , ...]
      ,
      currentIndex:'',


      setInterval(myTimer, 500);

      function myTimer()
      for (let i in array)
      if (Math.round(_myplayer.currentTime()) != 0)
      if (array[i].start_time < Math.round(_myplayer.currentTime()) && Math.round(_myplayer.currentTime()) <= array[i].end_time)
      this.currentIndex=i;




      ```


      these are the main pieces of my code, the main problem is to link the currentIndex to the id of the span. it's a kind of ted transcript text highlight
      sorry for my english, thank you










      share|improve this question
















      i need to change the class of some span to the pass of the time of a video. i create the span tags from an array with the v-for, inside the array i have the start time and stop time of the text, so i want to change the class of the single text checking the interval and the actual video time. i tried this code:



      ```

      <span :class="'selected':(item.id===currentIndex)" v-for="item in Array">
      item.text
      </span>


      data()
      return
      Array: [
      id: 0,
      start_time: 0,
      end_time: 1,
      text: "Hello"
      ,
      id: 1,
      start_time: 1,
      end_time: 2,
      text: "guys."
      ,
      id: 2,
      start_time: 2,
      end_time: 3,
      text: "In this lesson"
      , ...]
      ,
      currentIndex:'',


      setInterval(myTimer, 500);

      function myTimer()
      for (let i in array)
      if (Math.round(_myplayer.currentTime()) != 0)
      if (array[i].start_time < Math.round(_myplayer.currentTime()) && Math.round(_myplayer.currentTime()) <= array[i].end_time)
      this.currentIndex=i;




      ```


      these are the main pieces of my code, the main problem is to link the currentIndex to the id of the span. it's a kind of ted transcript text highlight
      sorry for my english, thank you







      vue.js






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 10:15







      peppeg85

















      asked Mar 27 at 10:09









      peppeg85peppeg85

      237 bronze badges




      237 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0














          Try to put set interval into 'created' life cycle hook like :



          created: function () 
          setInterval(myTimer, 500);



          Or better use v-model to watch your id






          share|improve this answer

























          • solved with " let _this=this " out of the function mytimere and using _this inside

            – peppeg85
            Mar 27 at 12:16










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55374607%2fchange-class-dinamically-to-the-pass-of-a-videotime%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Try to put set interval into 'created' life cycle hook like :



          created: function () 
          setInterval(myTimer, 500);



          Or better use v-model to watch your id






          share|improve this answer

























          • solved with " let _this=this " out of the function mytimere and using _this inside

            – peppeg85
            Mar 27 at 12:16















          0














          Try to put set interval into 'created' life cycle hook like :



          created: function () 
          setInterval(myTimer, 500);



          Or better use v-model to watch your id






          share|improve this answer

























          • solved with " let _this=this " out of the function mytimere and using _this inside

            – peppeg85
            Mar 27 at 12:16













          0












          0








          0







          Try to put set interval into 'created' life cycle hook like :



          created: function () 
          setInterval(myTimer, 500);



          Or better use v-model to watch your id






          share|improve this answer













          Try to put set interval into 'created' life cycle hook like :



          created: function () 
          setInterval(myTimer, 500);



          Or better use v-model to watch your id







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 10:39









          KanowKanow

          386 bronze badges




          386 bronze badges















          • solved with " let _this=this " out of the function mytimere and using _this inside

            – peppeg85
            Mar 27 at 12:16

















          • solved with " let _this=this " out of the function mytimere and using _this inside

            – peppeg85
            Mar 27 at 12:16
















          solved with " let _this=this " out of the function mytimere and using _this inside

          – peppeg85
          Mar 27 at 12:16





          solved with " let _this=this " out of the function mytimere and using _this inside

          – peppeg85
          Mar 27 at 12:16








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55374607%2fchange-class-dinamically-to-the-pass-of-a-videotime%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript