CSS 纵向顶部往下动画

请添加图片描述

<template>

	<div class="container" @mouseenter="startAnimation" @mouseleave="stopAnimation">
		<!-- 旋方块 -->
		<div class="box" :class="{ 'scale-up-ver-top': isAnimating }">
			<!-- 元素内容 -->
		</div>
	</div>
</template>

<script setup>
	import {
		ref
	} from 'vue';


	const isAnimating = ref(false); // 控制是否应用动画的响应式状态
	function startAnimation() {
		// 鼠标进入容器时,启动动画
		isAnimating.value = true;
	}

	function stopAnimation() {
		// 鼠标离开容器时,停止动画
		isAnimating.value = false;
	}
</script>

<style>
	.container {
		/* 定义容器宽度和高度 */
		width: 100px;
		height: 100px;
		margin-top: 50px;
		margin-left: 40%;
	}

	.box {
		/* 定义方块宽度和高度 */
		width: 100px;
		height: 100px;
		background-color: blue;
	
	}

	.scale-u

相关推荐

  1. CSS实现从上过渡效果

    2024-01-06 10:26:02       34 阅读
  2. CSS实现从上过渡效果

    2024-01-06 10:26:02       21 阅读
  3. VUE实现纵向动态表格

    2024-01-06 10:26:02       64 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-06 10:26:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-06 10:26:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-06 10:26:02       82 阅读
  4. Python语言-面向对象

    2024-01-06 10:26:02       91 阅读

热门阅读

  1. 基于等保合规和滑动标尺模型的云安全建设方法

    2024-01-06 10:26:02       61 阅读
  2. C#的StringBuilder方法

    2024-01-06 10:26:02       54 阅读
  3. 【基础八股文】html css js

    2024-01-06 10:26:02       60 阅读
  4. TCP发送和接受数据

    2024-01-06 10:26:02       59 阅读
  5. ajax/axios/fetch区别及webSocket通信原理

    2024-01-06 10:26:02       63 阅读
  6. 二叉树part04 算法

    2024-01-06 10:26:02       55 阅读
  7. 编写代码中常见问题汇总

    2024-01-06 10:26:02       53 阅读