element-api-ext

本文详细介绍了ExtJS中Element类的使用方法,包括属性设置、动画效果应用、元素选择等功能。此外,还提供了多个示例代码帮助理解如何利用Element进行DOM操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Class Ext.Element

Package:Ext
Defined In:Element.js
Class:Element
Subclasses:Layer
Extends:Object
Represents an Element in the DOM.

Usage:
// by id
var el = Ext.get("my-div");

// by DOM element reference
var el = Ext.get(myDivElement);
Animations
Many of the functions for manipulating an element have an optional "animate" parameter. The animate parameter should either be a boolean (true) or an object literal with animation options. Note that the supported Element animation options are a subset of the Ext.Fx animation options specific to Fx effects. The Element animation options are:
Option    Default   Description
--------- --------  ---------------------------------------------
duration  .35       The duration of the animation in seconds
easing    easeOut   The easing method
callback  none      A function to execute when the anim completes
scope     this      The scope (this) of the callback function
Also, the Anim object being used for the animation will be set on your options object as "anim", which allows you to stop or manipulate the animation. Here's an example:
var el = Ext.get("my-div");

// no animation
el.setWidth(100);

// default animation
el.setWidth(100, true);

// animation with some options set
el.setWidth(100, {
    duration: 1,
    callback: this.foo,
    scope: this
});

// using the "anim" property to get the Anim object
var opt = {
    duration: 1,
    callback: this.foo,
    scope: this
};
el.setWidth(100, opt);
...
if(opt.anim.isAnimated()){
    opt.anim.stop();
}
Composite (Collections of) Elements
For working with collections of Elements, see Ext.CompositeElement

Public Properties

PropertyDefined By
 Element.DISPLAY : Number
<static> Visibility mode constant - Use display to hide element
Element
 Element.VISIBILITY : Number
<static> Visibility mode constant - Use visibility to hide element
Element
 defaultUnit : String
The default unit to append to CSS values where a unit isn't provided (defaults to px).
Element
 dom : HTMLElement
The DOM element
Element
 id : String
The DOM element ID
Element
 originalDisplay : String
The element's default display mode (defaults to "")
Element

Public Methods

MethodDefined By

Public Events

This class has no public events.
 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值