Highlight 效果可以与effect()方法一起使用。这将以特定的颜色突出显示元素的背景,默认为黄色(yellow)。

Highlight - 语法

selector.effect( "highlight", {arguments}, speed );

这是所有参数的描述-

  • color    -  高亮显示颜色。默认值为"#ffff99"。

  • model  -  效果的模式。可以是"显示(show)","隐藏(hide)"。默认值为"显示"。

Highlight - 示例

以下是一个简单的示例,简单说明了此效果的用法-

<html>
   <head>
      <title>The jQuery Example</title>
      <script type="text/javascript" 
         src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
		
      <script type="text/javascript" 
         src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js">
      </script>
		
      <script type="text/javascript" language="javascript">
   
         $(document).ready(function() {

            $("#button").click(function(){
               $(".target").effect( "highlight", {color:"#669966"}, 3000 );
            });
         });
			
      </script>
		
      <style>
         p {background-color:#bca; width:200px; border:1px solid green;}
         div{ width:100px; height:100px; background:red;}
      </style>
   </head>
	
   <body>
      <p>Click the button</p>
      <button id="button"> Highlight </button>

      <div class="target">
      </div>
   </body>
</html>

这将产生以下输出-

参考链接

https://www.learnfk.com/jquery/effect-highlight.html