zoom 前台_鼠标hover元素scale/zoom中心点放大效果实例页面

这篇博客展示了如何使用CSS实现当鼠标hover元素时,使其按照中心点放大(scale)的效果。通过设置相对定位、绝对定位和transform属性,可以创建一个在鼠标悬停时元素放大1.05倍的交互效果。同时,文章还提供了不同定位方式的代码示例,包括左上角定位和居中定位。
摘要由CSDN通过智能技术生成

CSS代码:

.box {

/* 可见视觉区域 */

width: 480px; height: 250px;

position: relative;

overflow: hidden;

cursor: pointer;

}

.size {

/* 广阔的海洋 */

width: 1000px; height: 1000px;

position: absolute; left: 50%; top: 50%;

margin: -500px 0 0 -500px;

/* 水平居中 */

text-align: center;

}

.zoom {

/* 缩放的元素 */

width: 480px; height: 250px;

vertical-align: middle;

-webkit-transition: -webkit-transform .2s;

transition: transform .2s;

}

.box:hover .zoom {

/* hover放大 */

-webkit-transform: scale(1.05);

-ms-transform: scale(1.05);

transform: scale(1.05);

zoom: 1.05;

}

:root .box:hover .zoom {

zoom: 1;

}

.middle {

/* 垂直居中 */

static void Custom_Setting_To_InitStc(uint8_t u8Key_Function) { switch(u8Key_Function) { case WHITEBALANCE: Key_WhiteBalance(); break; case IMAGEFREEZE: Key_ImageFreeze(); break; case ZOOM_IN: Key_ZoomIn(); break; case ZOOM_OUT: Key_ZoomOut(); break; case PHOTO: Key_Photo(); break; case VIDEO: Key_Video(); break; default: break; } } void Dealwith_Key(void) { AD_KeyPolling(); //check AD conversion result switch(GetKey()) // Get the logical key, and implement the functions { case KEY_ZOOM_OUT: Custom_Setting_To_InitStc(g_stcSetting.stcPanelSetting.stcCustomSetting.u8Top_ShortRelease); break; case KEY_MENU: //top key middle press Custom_Setting_To_InitStc(g_stcSetting.stcPanelSetting.stcCustomSetting.u8Top_MiddlePress); break; case KEY_LEFT_SHORT: //left key release Custom_Setting_To_InitStc(g_stcSetting.stcPanelSetting.stcCustomSetting.u8Left_ShortRelease); break; case KEY_RECORD: //left key middle press Custom_Setting_To_InitStc(g_stcSetting.stcPanelSetting.stcCustomSetting.u8Left_MiddlePress); break; case KEY_ZOOM_IN: //down key release Custom_Setting_To_InitStc(g_stcSetting.stcPanelSetting.stcCustomSetting.u8Down_ShortRelease); break; case KEY_AWB: //down key middle press Custom_Setting_To_InitStc(g_stcSetting.stcPanelSetting.stcCustomSetting.u8Down_MiddlePress); break; case KEY_PHOTO: //right key release Custom_Setting_To_InitStc(g_stcSetting.stcPanelSetting.stcCustomSetting.u8Right_ShortRelease); break; case KEY_FREEZE: //right key middle press Custom_Setting_To_InitStc(g_stcSetting.stcPanelSetting.stcCustomSetting.u8Right_MiddlePress); break; default: break; } }优化这段代码
06-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值