Mootools 1.2教程(23)——滑动效果(Slide)(4)

作者:Fanhp 来源:Fdream博客 时间:2009-03-04 12:33:00 

代码示例

上面所讲的这些基本涵盖了全部基本用法。下面的示例将使用我们上面学到的大部分知识,显示一些不同的滑动元素,并提供一些div作为指示器,以便你可以清楚地看到这些事件。

首先,创建HTML文件。

参考代码: 

<div id="start" class="ind">Start</div> 
<div id="cancel" class="ind">Cancel</div> 
<div id="complete" class="ind">Complete</div> 
<br /><br /> 

<button id="openA">open A</button> 
<button id="closeA">close A</button> 
<div id="slideA" class="slide">Here is some content - A. Notice the delay before onComplete fires.  This is due to the transition effect, the onComplete will not fire until the slide element stops "elasticing." Also, notice that if you click back and forth, it will "cancel" the previous call and give the new one priority.</div> 

<button id="openB">open B</button> 
<button id="closeB">close B</button> 
<div id="slideB" class="slide">Here is some content - B. Notice how if you click me multiple times quickly I "chain" the events.  This slide is set up with the option "link: 'chain'"</div> 

<button id="openC">toggle C</button> 
<div id="slideC" class="slide">Here is some content - C</div> 

<button id="openD">toggle D</button> 
<div id="slideD" class="slide">Here is some content - D. Notice how I am not hooked into any events.  This was done with the .slide shortcut.</div> 

<button id="openE">toggle E</button> 

<div id="slide_wrap"> 
<div id="slideE" class="slide">Here is some content - E</div> 
</div>


接下来是CSS文件。我们让它尽量保持简单。

参考代码: 

.ind { 
    width: 200px; 
    padding: 10px; 
    background-color: #87AEE1; 
    font-weight: bold; 
    border-bottom: 1px solid white; 


.slide { 
    margin: 20px 0;  
    padding: 10px; 
    width: 200px; 
    background-color: #DAF7B4; 


#slide_wrap { 
    padding: 30px; 
    background-color: #D47000; 


标签:Mootools,教程,滑动,slide,JavaScript
0
投稿

猜你喜欢

  • mysql ON DUPLICATE KEY UPDATE语句示例

    2024-01-13 11:02:48
  • Python 操作mysql数据库查询之fetchone(), fetchmany(), fetchall()用法示例

    2023-07-09 00:11:24
  • 适合后台管理系统开发的12个前端框架(小结)

    2023-08-29 02:11:14
  • XML的简单读取与写入

    2008-09-04 10:35:00
  • pytorch绘制并显示loss曲线和acc曲线,LeNet5识别图像准确率

    2023-01-06 11:04:09
  • pydantic-resolve嵌套数据结构生成LoaderDepend管理contextvars

    2023-01-12 22:21:05
  • pyCaret效率倍增开源低代码的python机器学习工具

    2021-01-09 10:30:26
  • java正则表达式应用的实例代码

    2022-09-15 20:56:48
  • Python基于域相关实现图像增强的方法教程

    2023-08-24 15:30:22
  • 优化代码 改善CSS文件可读性

    2008-06-13 13:50:00
  • python将html转成PDF的实现代码(包含中文)

    2023-08-30 18:11:58
  • python使用pandas抽样训练数据中某个类别实例

    2021-03-02 02:56:14
  • sqlserver复制数据库的方法步骤(图文)

    2024-01-17 05:00:34
  • C#操作mysql数据库的代码实例

    2024-01-22 10:20:54
  • python绘制趋势图的示例

    2022-02-28 07:19:18
  • Python学习资料

    2021-11-12 17:17:01
  • Python使用tkinter模块实现GUI界面的学生信息管理系统流程分步详解

    2022-04-06 18:09:53
  • python tkinter实现屏保程序

    2023-02-20 14:31:20
  • MySQL自定义函数和存储过程示例详解

    2024-01-27 15:25:02
  • Python自定义装饰器原理与用法实例分析

    2023-01-19 05:12:06
  • asp之家 网络编程 m.aspxhome.com