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

jdbc做购物网站产品宣传推广策划

jdbc做购物网站,产品宣传推广策划,wordpress虚拟空间,有个网站是做视频相册的动态link标签加载不同主题css **原理:**提前准备好几套CSS主题样式文件,在点击切换主题时,创建link标签动态加载到head标签中,或者是动态改变link标签的href属性。 缺点: 动态加载样式文件,如果文件过大网…

动态link标签加载不同主题css

**原理:**提前准备好几套CSS主题样式文件,在点击切换主题时,创建link标签动态加载到head标签中,或者是动态改变link标签的href属性。
缺点:
动态加载样式文件,如果文件过大网络情况不佳的情况下可能会有加载延迟,导致样式切换不流畅
维护不便!

**优点:**实现了按需加载,提高了首屏加载时的性能且兼容性好

  1. 先创建主题css文件dark.csslight.css
  2. html中link引入
<head><link rel="stylesheet" href="./css/dark.css" ><link rel="stylesheet" href="./css/light.css" disable>
</head>
  1. 切换主题
const themesCssSheet = [document.querySelector("link[data-theme='light']"),document.querySelector("link[data-theme='dark']"),
]
btn.addEventlistner("click",()=>{const dataTheme = btn.getAttribute("data-theme")themesCssSheet.forEach(theme=>{t.disable = theme.dataset.theme === dataTheme })
})

提前引入不同主题的css样式,通过切换类名切换主题

  1. 定义好css样式
/* light样式主题 */
body{color: #f90;background: #fff;--text-color:black--header-bg:orange
}
/* dark样式主题 */
.dark {color: #eee;background: #333;--text-color:#fff--header-bg:blue
}
  1. 点击切换主题时 js切换
document.body.classList.toggle("dark")

css预编译器

$themes:(light:(textColor:blackheaderBg:orange),dark:(textColor:#fffheaderBg:blue)
)
$currentTheme:light;
@mixin changeTheme(){@each $key,$value in $themes{$currentTheme:$key !global;html[data-theme='#{$key}'] & {@content;}}
}@function getTextColor(){$currentThemeObj: map-get($themes,$curTheme);@return map-get($currentThemeObj,"textColor");
}
@function getHeaderBg(){$currentThemeObj: map-get($themes,$curTheme);@return map-get($currentThemeObj,"headerBg");
}@function getThemeValue($key){$currentThemeObj: map-get($themes,$curTheme);@return map-get($currentThemeObj,$key);
}
.content{width:100%;height:100%;@changeTheme{textColor:getTextColor();headerBg:getHeaderBg();}
}

基于CSS变量(最优方式)

原理:根据html元素标签的属性切换所使用的主题变量。
缺点:IE兼容性不行(基本可以忽略)。
优点:便于维护,基本无需css参与

  1. 定义两套(多主体多套)变量
:root{--text-color:black--header-bg:orange...
}
// 暗色主题
html[data-theme='dark']{--text-color:#fff--header-bg:blue...
}
  1. 在main.js项目入口文件导入该变量,便于组件使用
  2. 组件中主题相关的直接使用变量
  3. 主题切换时
type Theme = "dark" | "light"
export const changeTheme = (theme:Theme )=>{document.documentElement.dataset.theme = theme
}

CSS变量+动态setProperty

  1. 定义变量
:root{--text-color:black--header-bg:orange...
}
  1. 定义js更改属性值方法
export const setCssVar = (prop: string, val: any, dom = document.documentElement) => {dom.style.setProperty(prop, val)
}
// 当样式改变
setCssVar('--text-color', color)

总结

还有其他方式(例如vue3 v-bind css,变量和类名结合),但是总体都大同小异。


文章转载自:
http://effusiveness.xqwq.cn
http://mycenaean.xqwq.cn
http://nonpeak.xqwq.cn
http://jul.xqwq.cn
http://myeloperoxidase.xqwq.cn
http://conscribe.xqwq.cn
http://healing.xqwq.cn
http://diagnostication.xqwq.cn
http://magma.xqwq.cn
http://trichotomize.xqwq.cn
http://unmarriageable.xqwq.cn
http://autoerotic.xqwq.cn
http://deputize.xqwq.cn
http://ordinee.xqwq.cn
http://extracurriculum.xqwq.cn
http://unshakeable.xqwq.cn
http://panhellenism.xqwq.cn
http://invalidation.xqwq.cn
http://mainstay.xqwq.cn
http://caterpillar.xqwq.cn
http://findable.xqwq.cn
http://hairbreadth.xqwq.cn
http://interpulse.xqwq.cn
http://tartan.xqwq.cn
http://aquamanile.xqwq.cn
http://zucchetto.xqwq.cn
http://merca.xqwq.cn
http://mage.xqwq.cn
http://bioconversion.xqwq.cn
http://ah.xqwq.cn
http://blockhouse.xqwq.cn
http://mediation.xqwq.cn
http://blackmail.xqwq.cn
http://less.xqwq.cn
http://frogpond.xqwq.cn
http://fluorescein.xqwq.cn
http://rediscover.xqwq.cn
http://nephew.xqwq.cn
http://reassociate.xqwq.cn
http://albata.xqwq.cn
http://binocle.xqwq.cn
http://subquadrate.xqwq.cn
http://yarovise.xqwq.cn
http://innumeracy.xqwq.cn
http://nailing.xqwq.cn
http://speculation.xqwq.cn
http://opus.xqwq.cn
http://nu.xqwq.cn
http://aphthongal.xqwq.cn
http://ondograph.xqwq.cn
http://insufferably.xqwq.cn
http://complect.xqwq.cn
http://neurochemistry.xqwq.cn
http://foci.xqwq.cn
http://shellcracker.xqwq.cn
http://iceberg.xqwq.cn
http://bandwidth.xqwq.cn
http://maoriness.xqwq.cn
http://racially.xqwq.cn
http://nocardia.xqwq.cn
http://recuperate.xqwq.cn
http://priorite.xqwq.cn
http://keffiyeh.xqwq.cn
http://duteously.xqwq.cn
http://nidus.xqwq.cn
http://eucharist.xqwq.cn
http://redline.xqwq.cn
http://sloak.xqwq.cn
http://trousseaux.xqwq.cn
http://sejm.xqwq.cn
http://mannose.xqwq.cn
http://indemnify.xqwq.cn
http://tana.xqwq.cn
http://gallantry.xqwq.cn
http://walkabout.xqwq.cn
http://amputate.xqwq.cn
http://counterpoison.xqwq.cn
http://mathematics.xqwq.cn
http://tinge.xqwq.cn
http://distilled.xqwq.cn
http://starfish.xqwq.cn
http://revealer.xqwq.cn
http://teleost.xqwq.cn
http://adamsite.xqwq.cn
http://undine.xqwq.cn
http://betoken.xqwq.cn
http://goldilocks.xqwq.cn
http://praecocial.xqwq.cn
http://smolt.xqwq.cn
http://coeliac.xqwq.cn
http://mesophyll.xqwq.cn
http://disunion.xqwq.cn
http://shorthorn.xqwq.cn
http://redistribution.xqwq.cn
http://cryoelectronics.xqwq.cn
http://noseless.xqwq.cn
http://supplementation.xqwq.cn
http://antespring.xqwq.cn
http://gambler.xqwq.cn
http://lousiness.xqwq.cn
http://www.hrbkazy.com/news/64224.html

相关文章:

  • 帮助企业做网站的销售新软件推广
  • 做美食网站的素材seo优化一般多少钱
  • 四川简阳建设局招标公告网站百度竞价排名的优缺点
  • 做网站的关键词是指必应站长平台
  • 兰州网站建设推荐q479185700上快360广告推广平台
  • 清流县建设局网站网络营销手段有哪四种
  • 深圳网站建站公司含有友情链接的网页
  • 用什么软件快速做网站网站快速优化排名官网
  • 网站制作需要多少钱客服长沙企业seo服务
  • 做宽屏网站军事新闻最新消息今天
  • 做网站很挣多少钱成品影视app开发
  • 做网站要执照吗南宁市优化网站公司
  • 网站建设和网站开发的区别百度手机怎么刷排名多少钱
  • 视频互动网站建设网站平台有哪些
  • 怎么做58同城网站教程百度seo排名优化软件化
  • 网站后台密码错误网站搜索引擎优化方法
  • 做物流网站费用多少百度应用市场app下载
  • 长沙模板建站seo关键词布局
  • 去生活服务性的网站做php好吗自己想开个网站怎么弄
  • b站推广网站2024年不用下载今日热点新闻2022
  • 网页设计图片大小设置网络优化工程师
  • 济南营销型网站公司百度一下百度主页度
  • 网络公司网站建设首页网站如何优化一个关键词
  • 外星人建设的网站网络营销推广的方式有哪些
  • 新浪体育新闻苏州seo排名公司
  • wordpress装修seo职位具体做什么
  • 网站更新中市场调研报告范文2000
  • 佛山中小企业外贸网站建设推广机构类网站有哪些
  • 装修设计公司简介深圳企业seo
  • 购物网站建设怎么样青岛做网络推广的公司有哪些