title: "退出动画控制" post_status: publish comment_status: open taxonomy: category: - elementor-developers-docs post_tag: - Editor Controls - Src - Repos
退出动画控制
Elementor 退出动画控制基于 Animate.css 库显示一个选择框字段。该控制允许为项目设置退出动画效果。
该控件在 Control_Exit_Animation 类中定义,该类继承自 Control_Animation 类,而 Control_Animation 类又继承自 Base_Data_Control 类。
使用此控件时,应将 type 设置为 \Elementor\Controls_Manager::EXIT_ANIMATION 常量。
参数
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
type |
string |
exit_animation | 控件的类型。 |
label |
string |
显示在字段上方的标签。 | |
description |
string |
显示在字段下方的描述。 | |
show_label |
bool |
true | 是否显示标签。 |
label_block |
bool |
false | 是否在单独一行显示标签。 |
separator |
string |
default | 设置控件分隔符的位置。可用值为 default、before 和 after。default 将隐藏分隔符,除非控件类型有特定的分隔符设置。before / after 会将分隔符定位在控件之前/之后。 |
default |
string |
字段的默认值。 |
Return Value
(string) The selected exit animation class.
Usage
```php {14-21,30-32,38-40}
start_controls_section( 'style_section', [ 'label' => esc_html__( 'Style', 'textdomain' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'exit_animation', [ 'label' => esc_html__( 'Exit Animation', 'textdomain' ), 'type' => \Elementor\Controls_Manager::EXIT_ANIMATION, 'prefix_class' => 'animated ', ] ); $this->end_controls_section(); } protected function render(): void { $settings = $this->get_settings_for_display(); ?> <div class="<?php echo esc_attr( $settings['exit_animation'] ); ?>">
...
</div>
<?php
}
protected function content_template(): void {
?>
<div class="{{ settings.exit_animation }}">
...
</div>
<?php
}
} ```