Search code examples
jqueryhtmlcssknockout.jsmarquee

Knockout.js Jquery Marquee Function


I'm trying to MARQUEE text using JQUERY.MARQUEE when a condition is met.

For instance, if text.length > 10, Marquee Text.

CSS:

 <style>
 .title-marquee { 
      color: red !important;
      width: 200px !important;
      overflow: hidden !important;
      display: block !important;
 }
 </style>

HTML:

 <th class="movie-title" data-bind="text: title, css: { 'title-marquee' : title.length > 10 }"></th>

JQUERY:

 $('.title-marquee').marquee({
 duplicated: true
 });

I have the HTML & CSS working correctly, but JQUERY isn't initiating.


Solution

  • I think you title must be title() HTML will be

    <th class="movie-title" data-bind="text: title, css: { 'title-marquee' : title().length > 10 }"></th>
    

    Here is the working JsFiffle

    Hope. it may help you at some point. Have a nice day :)