当前位置: 首页 > news >正文

大连公司注册网站推广网站要注意什么

大连公司注册网站,推广网站要注意什么,河东手机站,网络空间治理需求&#xff1a;点击按钮希望像在PC端那样有个类似于hover的效果&#xff0c;触摸按钮变色&#xff0c;手指离开变回原来的颜色&#xff1b;方法一&#xff1a;CSS3JS 用keyframes动画&#xff0c;js点击按钮时添加keyframes动画&#xff0c;定时器移除keyframes动画 <!DOC…
  • 需求:点击按钮希望像在PC端那样有个类似于hover的效果,触摸按钮变色,手指离开变回原来的颜色;

方法一:CSS3+JS

用keyframes动画,js点击按钮时添加keyframes动画,定时器移除keyframes动画
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"><title>移动端按钮点击变色之后还原</title><link rel="stylesheet" type="text/css" href="http://dn.yunzhenshi.com/css/reset-min.css"><style>.btn{font-size: 1.5em;line-height: 2em;text-align: center;background: #ce4f54;color: #fff;width: 200px;}.bounce {-webkit-animation-name: bounce;animation-name: bounce;-webkit-animation-duration: 1s;animation-duration: 1s;-webkit-animation-fill-mode: both;animation-fill-mode: both-webkit-transform-origin: center bottom;-ms-transform-origin: center bottom;transform-origin: center bottom}#jq22{animate-duration: 2s;    /*//动画持续时间*/animate-delay: 1s;    /*//动画延迟时间*/animate-iteration-count: 1;    /*//动画执行次数*/}@-webkit-keyframes bounce {0%{background: #ce4f54;}50%{background: #ff0;}100%{background: #ce4f54;}}@keyframes bounce {0%{background: #ce4f54;}50%{background: #ff0;}100%{background: #ce4f54;}}</style>
</head>
<body><div id="jq22" class="btn">按钮按钮</div><script src="http://dn.yunzhenshi.com/js/jquery-1.8.3.min.js"></script>
<script>$(function () {$('#jq22').click(function () {$('#jq22').addClass('bounce');setTimeout(function(){$('#jq22').removeClass('bounce');}, 1000);});});
</script>
</body>
</html>

方法二:JS

用touchstart,touchend来进行样式的添加和移除。
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"><title>移动端按钮点击变色之后还原</title><link rel="stylesheet" type="text/css" href="http://dn.yunzhenshi.com/css/reset-min.css"><style>.btn1{font-size: 1.5em;line-height: 2em;text-align: center;background: #ce39bd;color: #fff;width: 200px;}.btn2{font-size: 1.5em;line-height: 2em;text-align: center;background: #f00;color: #fff;width: 200px;}</style>
</head>
<body><div id="jq22" class="btn1">按钮按钮</div><script src="http://dn.yunzhenshi.com/js/jquery-1.8.3.min.js"></script>
<script>$(function () {function changeColor(id,class1,class2) {$("#"+id).on("touchstart",function () {$(this).attr("class",class1)})$("#"+id).on("touchend",function () {$(this).attr("class",class2)})}changeColor("jq22","btn2","btn1")});
</script>
</body>
</html>

方法三:JS

网友的力量是强大,后来从网上找到了一个列表页的demo,升级版。
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"><title>移动端模拟hover</title><style>html {font-size: 100px;}* {font-size: .16rem;}.content {position: absolute;top: 0;bottom: 0;left: 0;right: 0;overflow: auto;z-index: 10;background-color: #fff;-webkit-overflow-scrolling: touch;}.items {margin: 0;padding: 0;list-style: none;}.items li {box-sizing: border-box;line-height: .40rem;text-indent: 1em;border-bottom: 1px solid #e3e3e3;}.items li.active {background-color: #e3e3e3;}</style>
</head>
<body>
<div class="content"><ul class="items"><li class="action-btn">item1</li><li class="action-btn">item2</li><li class="action-btn">item3</li><li class="action-btn">item4</li><li class="action-btn">item5</li></ul>
</div><script src="http://dn.yunzhenshi.com/js/jquery-1.8.3.min.js"></script>
<script>$(function () {//自定义tap$(document).on("touchstart", function (e) {if (!$(e.target).hasClass("disable")) $(e.target).data("isMoved", 0);});$(document).on("touchmove", function (e) {if (!$(e.target).hasClass("disable")) $(e.target).data("isMoved", 1);});$(document).on("touchend", function (e) {if (!$(e.target).hasClass("disable") && $(e.target).data("isMoved") == 0) $(e.target).trigger("tap");});//按钮点击效果$(document).on("touchstart", ".action-btn:not(.disable)", function (e) {var $this = $(this);var flag = true;//遍历子类$this.find("*").each(function () {//查看有没有子类触发过active动作if ($(this).hasClass("active")) flag = false;});//如果子类已经触发了active动作,父类则取消active触发操作if (flag) $this.addClass("active");});$(document).on("touchmove", ".action-btn:not(.disable)", function (e) {if ($(this).hasClass("active")) $(this).removeClass("active");});$(document).on("touchend", ".action-btn:not(.disable)", function (e) {if ($(this).hasClass("active")) $(this).removeClass("active");});});
</script>
</body>
</html>
http://www.lbrq.cn/news/2436427.html

相关文章:

  • 那个网站教我做美食最好海会网络做的网站怎么做优化
  • 企业网站建设成本费用百度一下百度搜索百度
  • 网站怎么建在国外网络营销与传统营销有哪些区别
  • 装修公司网站多少钱网站建设优化哪家公司好
  • 企业网站建设 广州网站怎么弄
  • 党建专栏 文字说明 网站建设南宁整合推广公司
  • 上海建网站多少钱营销型网站建设的公司
  • 网站建设总结报告爱站网seo
  • 最新章节 第一百四十七章 做视频网站seoul是什么意思中文
  • 程序开发外包平台广东企业网站seo报价
  • 美国设计公司排名搜索引擎优化seo应用
  • 高端网站建设搭建单页网站seo如何优化
  • 免费ppt模板在哪里下载桂林seo顾问
  • joomla做的网站网络营销代运营外包公司
  • 外贸网站建设专业自动外链发布工具
  • 贸易网站源码百度seo排名软
  • 课程的网站建设怎么注册自己的网站
  • 晋城企业网站建设公司5118站长网站
  • 众筹网站功能百度识图在线使用一下
  • 做网站一般做几个尺寸微信群推广网站
  • 衡阳做网站ss0734上海seo网站优化软件
  • 德清网站设计谷歌浏览器 免费下载
  • 温州设计集团网站建设百度高级搜索入口
  • 延安市城乡建设局网站seo怎么去优化
  • 网络设计思路百度关键词快速优化
  • 大连做网站哪家好一点2023年9月疫情又开始了吗
  • 电商设计网站有哪些内容建网站的公司排名
  • 上海58同城招聘网最新招聘太原百度快速优化
  • 福州外贸网站建设国内新闻大事20条
  • 旅游电子商务网站开发制作如何用google搜索产品关键词
  • JS逆向基础( AES 解密密文WordArray和Uint8Array实战②)
  • Coze智能体1分钟全自动生成哲学主义解析视频,无需写文案,无需剪辑
  • [2025CVPR-小目标检测方向]基于特征信息驱动位置高斯分布估计微小目标检测模型
  • 怎么在Mac系统中使用不坑盒子?
  • zabbix“专家坐诊”第295期问答
  • Unity笔记——事件中心