jQuery 中的 Blind方法函数

首页 / jQuery入门教程 / jQuery 中的 Blind方法函数

Blind 效果可以与show/hide/toggle一起使用。这会将元素隐藏起来,或者通过将其隐藏而显示出来。

Blind - 语法

selector.hide|show|toggle( "blind", {arguments}, speed );

这是所有参数的描述-

链接:https://www.learnfk.comhttps://www.learnfk.com/jquery/effect-blind.html

来源:LearnFk无涯教程网

  • direction - 效果的方向。可以是"vertical(垂直)"或"horizontal(水平)"。默认为垂直。

  • mode       - 效果的模式。可以是"show"或"hide"。默认值为hide。

Blind - 示例

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

<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() {

            $("#hide").click(function(){
               $(".target").hide( "blind", {direction: "horizontal"}, 1000 );
            });

            $("#show").click(function(){
               $(".target").show( "blind", {direction: "horizontal"}, 1000 );
            });
				
         });
      </script>
		
      <style>
         p {background-color:#bca; width:200px; border:1px solid green;}
      </style>
   </head>
	
   <body>
      <p>Click on any of the buttons</p>
		
      <button id="hide"> Hide </button>
      <button id="show"> Show</button> 
		
      <div class="target">
         <img src="../images/jquery.jpg" alt="jQuery" />
      </div>
   </body>
</html>

这将产生以下输出-

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

微服务架构核心20讲 -〔杨波〕

机器学习40讲 -〔王天一〕

Redis核心技术与实战 -〔蒋德钧〕

WebAssembly入门课 -〔于航〕

代码之丑 -〔郑晔〕

说透芯片 -〔邵巍〕

陈天 · Rust 编程第一课 -〔陈天〕

大型Android系统重构实战 -〔黄俊彬〕

B端产品经理入门课 -〔董小圣〕

好记忆不如烂笔头。留下您的足迹吧 :)