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

seo如何推广网站抖音同城推广

seo如何推广网站,抖音同城推广,org的域名网站,网站seo怎样做返回顶部模块 你可以使用 JavaScript 和 CSS 来实现滚动到底部时显示侧边栏#xff0c;并点击返回顶部按钮返回页面顶部的效果。下面是一个简单的示例代码#xff1a; HTML#xff1a; !DOCTYPE html html headstyle#sidebar {position:…返回顶部模块 你可以使用 JavaScript 和 CSS 来实现滚动到底部时显示侧边栏并点击返回顶部按钮返回页面顶部的效果。下面是一个简单的示例代码 HTML !DOCTYPE html html headstyle#sidebar {position: fixed;top: 50%;right: 10px;transform: translateY(-50%);width: 100px;height: 200px;background-color: #ccc;display: none;}#backToTop {position: fixed;bottom: 20px;right: 20px;display: none;}/style /head bodydiv idsidebar侧边栏内容/divbutton idbackToTop返回顶部/button!-- 页面内容 --pLorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eu risus vel arcu gravida iaculis. Ut fringilla semper tellus vitae ornare. Donec fermentum mauris in nisl ullamcorper, eget mollis nunc viverra. Quisque luctus enim a finibus cursus. Nam tincidunt nulla non efficitur ultrices. Phasellus nec ligula vel metus rutrum malesuada./ppCurabitur non dignissim eros. Nullam tempor mauris lectus, iaculis pellentesque erat posuere cursus. Proin elementum ex a urna cursus, ut malesuada turpis eleifend. Sed varius sem et imperdiet tempor. Fusce ac semper enim./p!-- ... --script srcscript.js/script /body /htmlJavaScript在 script 标签或外部脚本文件中 window.addEventListener(scroll, function() {var sidebar document.getElementById(sidebar);var backToTopButton document.getElementById(backToTop);if (window.innerHeight window.scrollY document.body.offsetHeight) {sidebar.style.display block;} else {sidebar.style.display none;}if (window.scrollY 0) {backToTopButton.style.display block;} else {backToTopButton.style.display none;} });document.getElementById(backToTop).addEventListener(click, function() {window.scrollTo({ top: 0, behavior: smooth }); });这段代码使用了 window 对象的 scroll 事件来监听页面滚动事件。当页面滚动到底部时侧边栏会显示出来当页面顶部时返回顶部按钮会显示出来。点击返回顶部按钮时使用 window.scrollTo() 方法将页面平滑滚动到顶部。 注意你可能需要将 JavaScript 代码放在 body 结束标签之前或者在 DOM 加载完成后执行脚本例如使用 DOMContentLoaded 事件以确保正确获取元素。 解释这段代码的作用if (window.innerHeight window.scrollY document.body.offsetHeight) {这段代码的作用是判断页面是否已经滚动到了底部。具体来说它使用了以下值进行比较 window.innerHeight表示浏览器窗口的视口高度即用户当前可见的页面区域的高度。window.scrollY表示页面在垂直方向已经滚动的距离。document.body.offsetHeight表示整个文档的高度包括了滚动条未显示的部分。 当满足条件 window.innerHeight window.scrollY document.body.offsetHeight 时就意味着滚动条已经滚动到了页面底部。这是因为 window.innerHeight window.scrollY 表示当前视口底部相对于页面顶部的距离而 document.body.offsetHeight 表示整个页面的高度。当这两者之和大于等于页面的总高度时就表示用户已经滚动到了页面底部。 在实际应用中可以利用这个判断来触发一些特定的操作或者显示相关的内容比如加载更多内容、显示返回顶部按钮等。
http://www.yutouwan.com/news/240249/

相关文章:

  • 在淘宝上做的网站要转出简历制作免费模板网站
  • 永久免费素材网站wordpress加入购买功能
  • 服装加盟的网站建设淘宝客优惠券网站建设教程视频
  • 查关键词热度的网站seo站长工具推广平台
  • 江津网站建设公司网站原型是什么
  • 网站关键词优化seo关键词之间最好用逗号微信小程序登陆入口
  • 做网站需要多少职务百事可乐运用了哪种网络营销方式
  • 张掖网站建设培训福建省建设执业资格注册中心网站
  • 北京网站排名方案学校网站代码
  • 网站建设的理由浏览器大全列表
  • 木马网站怎么做济南品牌网站建设价格
  • 南昌本地生活网站有哪些苏州网页制作
  • 最好好看的中文字幕seo广告投放是什么意思
  • 石家庄建站网页模板大型网站改版
  • 网站建设体质喝什么茶网络编程培训
  • asp.net网站恢复seo和sem的关系
  • vps搭建个人网站上海网站设计开发公
  • 青岛外贸网站推广自己如何建设校园网站
  • 网站建设优化建议注册公司注册地址
  • 长沙如何做百度的网站广东东莞大益队
  • 网站 数据库选择网站建设公司怎么寻找客户呢
  • 网页网站模板石家庄飞数科技
  • 如何注册一个网站优化网站排名茂名厂商
  • 网站制作软件 aws西陆网
  • 网站建设 视频教程环保网站怎么做
  • 网站维护具体做啥网络营销推广方法及策略选择
  • 网站一定要备案广州冼村地铁站
  • 广州建外贸网站手机网站建设报价多少
  • 邹平县城乡建设局网站wordpress原生相册
  • 网站的动态新闻数据库怎么做化妆品网站设计报告