1. <legend id='Rz5zy'><style id='Rz5zy'><dir id='Rz5zy'><q id='Rz5zy'></q></dir></style></legend>
      <tfoot id='Rz5zy'></tfoot>
    2. <small id='Rz5zy'></small><noframes id='Rz5zy'>

        <bdo id='Rz5zy'></bdo><ul id='Rz5zy'></ul>

    3. <i id='Rz5zy'><tr id='Rz5zy'><dt id='Rz5zy'><q id='Rz5zy'><span id='Rz5zy'><b id='Rz5zy'><form id='Rz5zy'><ins id='Rz5zy'></ins><ul id='Rz5zy'></ul><sub id='Rz5zy'></sub></form><legend id='Rz5zy'></legend><bdo id='Rz5zy'><pre id='Rz5zy'><center id='Rz5zy'></center></pre></bdo></b><th id='Rz5zy'></th></span></q></dt></tr></i><div id='Rz5zy'><tfoot id='Rz5zy'></tfoot><dl id='Rz5zy'><fieldset id='Rz5zy'></fieldset></dl></div>

        用于生成多色文本的 jQuery 插件,在悬停时会改变颜色

        时间:2023-11-30
          <tfoot id='DwFpT'></tfoot>
            <tbody id='DwFpT'></tbody>

            • <small id='DwFpT'></small><noframes id='DwFpT'>

                <bdo id='DwFpT'></bdo><ul id='DwFpT'></ul>
                1. <legend id='DwFpT'><style id='DwFpT'><dir id='DwFpT'><q id='DwFpT'></q></dir></style></legend>

                  <i id='DwFpT'><tr id='DwFpT'><dt id='DwFpT'><q id='DwFpT'><span id='DwFpT'><b id='DwFpT'><form id='DwFpT'><ins id='DwFpT'></ins><ul id='DwFpT'></ul><sub id='DwFpT'></sub></form><legend id='DwFpT'></legend><bdo id='DwFpT'><pre id='DwFpT'><center id='DwFpT'></center></pre></bdo></b><th id='DwFpT'></th></span></q></dt></tr></i><div id='DwFpT'><tfoot id='DwFpT'></tfoot><dl id='DwFpT'><fieldset id='DwFpT'></fieldset></dl></div>
                2. 本文介绍了用于生成多色文本的 jQuery 插件,在悬停时会改变颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想为各种链接生成多色文本,从预先指定的颜色数组中为单个字母随机分配颜色,当将鼠标悬停在带有文本的 div 上时,颜色会发生变化.我在想一个jQuery 插件/脚本将是要走的路.

                  I would like to generate multicoloured text for various links, with a random assignment of colours to individual letters, from a pre-specified array of colours, which would change on hovering over the div with the text in. I am thinking a jQuery plugin/script would be the way to go.

                  我想知道是否存在这样的插件或近似值.

                  I am wondering if such a plugin, or a close approximation, exists.

                  谢谢,

                  尼克

                  推荐答案

                  好的,我用 jquery 举个例子.

                  Ok i whip up an example using jquery.

                  首先是你的文字

                  <p id="example">Multi color me</p>
                  

                  然后是javascript:

                  then the javascript:

                  $(document).ready(function() {
                    var test = $("#example").text().split('');
                  
                      var result = "";
                      var i = 0;
                      for(i=0; i < test.length; i++) {
                          result += "<span style='color:"+getColor()+"'>"+test[i]+"</span>";
                      }
                      $("#example").html(result);      
                  });
                  
                  function getColor() {
                      var colList = ['#00FF00', '#FF0000','#0000FF'];
                  
                      var i = Math.floor((Math.random()*colList.length));
                    return colList[i];
                  }
                  

                  这是 jsFiddle 示例

                  Heres the jsFiddle Example

                  注意:我没有做悬停,但我猜你可以从这里拿它:)

                  Note: i did not do the hover but I guessing you can take it from here :)

                  这篇关于用于生成多色文本的 jQuery 插件,在悬停时会改变颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:html javascript 显示图像悬停 下一篇:响应式图像悬停 - CSS/JQuery

                  相关文章

                3. <tfoot id='GAAv9'></tfoot>

                    <small id='GAAv9'></small><noframes id='GAAv9'>

                      <bdo id='GAAv9'></bdo><ul id='GAAv9'></ul>
                  1. <i id='GAAv9'><tr id='GAAv9'><dt id='GAAv9'><q id='GAAv9'><span id='GAAv9'><b id='GAAv9'><form id='GAAv9'><ins id='GAAv9'></ins><ul id='GAAv9'></ul><sub id='GAAv9'></sub></form><legend id='GAAv9'></legend><bdo id='GAAv9'><pre id='GAAv9'><center id='GAAv9'></center></pre></bdo></b><th id='GAAv9'></th></span></q></dt></tr></i><div id='GAAv9'><tfoot id='GAAv9'></tfoot><dl id='GAAv9'><fieldset id='GAAv9'></fieldset></dl></div>
                    <legend id='GAAv9'><style id='GAAv9'><dir id='GAAv9'><q id='GAAv9'></q></dir></style></legend>