如何编写实现日历自动滚动的脚本?

更新于
2026-09-30 20:09:20
1阅读来源:SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计210个文字,预计阅读时间需要1分钟。

如何编写实现日历自动滚动的脚本?

将以下代码简化并去除冗余部分,不超过100个字:

javascript$(function() { var nowLineTop=$('#now-line').offset().top; $('#sc-view.timed-scroll .sc-container-view').scrollTop(nowLineTop);});

跳转到最上

//var _nowLineTop = $(".now-line").offset().top; //var _nowLineTop = $(".now-line").position().top; //$(".sc-view.timed-scroll > .sc-container-view").scrollTop(_nowLineTop); var _top = $(".sc-view.timed-scroll > .sc-container-view").offset().top; $(".sc-view.timed-scroll > .sc-container-view").scrollTop($(".now-line").position().top - _top); var _top = $(".sc-view.timed-scroll > .sc-container-view").offset().top; var _scrollTop = $(".now-line").position().top; $(".sc-view.timed-scroll > .sc-container-view").scrollTop(_scrollTop); console.info("scroll", _scrollTop); 插件自动滚动

// ==UserScript== // @name icloud 日历自动滚动 // @namespace tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author Topin // @match www.icloud.com/applications/calendar/current/zh-cn/index.html // @grant none // ==/UserScript== (function() { console.info("日历自动滚动-启用"); setInterval(function(){ var _scrollTop = $(".now-line").position().top; $(".sc-view.timed-scroll > .sc-container-view").scrollTop(_scrollTop - 33); console.info("scroll", _scrollTop); }, 1000*20); })();

如何编写实现日历自动滚动的脚本?

本文共计210个文字,预计阅读时间需要1分钟。

如何编写实现日历自动滚动的脚本?

将以下代码简化并去除冗余部分,不超过100个字:

javascript$(function() { var nowLineTop=$('#now-line').offset().top; $('#sc-view.timed-scroll .sc-container-view').scrollTop(nowLineTop);});

跳转到最上

//var _nowLineTop = $(".now-line").offset().top; //var _nowLineTop = $(".now-line").position().top; //$(".sc-view.timed-scroll > .sc-container-view").scrollTop(_nowLineTop); var _top = $(".sc-view.timed-scroll > .sc-container-view").offset().top; $(".sc-view.timed-scroll > .sc-container-view").scrollTop($(".now-line").position().top - _top); var _top = $(".sc-view.timed-scroll > .sc-container-view").offset().top; var _scrollTop = $(".now-line").position().top; $(".sc-view.timed-scroll > .sc-container-view").scrollTop(_scrollTop); console.info("scroll", _scrollTop); 插件自动滚动

// ==UserScript== // @name icloud 日历自动滚动 // @namespace tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author Topin // @match www.icloud.com/applications/calendar/current/zh-cn/index.html // @grant none // ==/UserScript== (function() { console.info("日历自动滚动-启用"); setInterval(function(){ var _scrollTop = $(".now-line").position().top; $(".sc-view.timed-scroll > .sc-container-view").scrollTop(_scrollTop - 33); console.info("scroll", _scrollTop); }, 1000*20); })();

如何编写实现日历自动滚动的脚本?