当前位置:网站首页>"Original" "Tutorial" to add a small pendant of the telescopic sidebar to the Joe theme article page
"Original" "Tutorial" to add a small pendant of the telescopic sidebar to the Joe theme article page
2022-08-05 13:02:00 【Fuuuy】
前言
In fact, this little pendant is thereJoe4.X的时候有的,Just an upgrade5.0The author has since removed it
I also transplanted it,Last month, a friend saw it and liked it very much,Let me make a tutorial
It was a happy promise at the time,But there was oneFlag,The second half of the month has been very busy,Until today, my friend came to ask me again,我才想起Flagnot pulled yet :$(发呆)
What was promised can't be put off any longer,I haven't updated my blog for a long time,正好今天有空,Just write it
效果展示
教程开始
一、 Add background switch
在 Joe/functions.php 里添加一下代码(当然,If you have seen my other tutorials,引入了 Joe/public/custom.php这个文件,You can also add it directly to this )
// Retractable sidebar switch
$AsideStretch = new Typecho_Widget_Helper_Form_Element_Select(
'AsideStretch',
array(
'off' => '关闭(默认)',
'on' => '开启',
),
'on',
'Whether to enable the retractable sidebar switch function',
'介绍:开启后,A module with a retractable sidebar appears on the page'
);
$AsideStretch->setAttribute('class', 'joe_content joe_change'); //如未生效,需将joe_change换成joe_other
$form->addInput($AsideStretch->multiMode());二、添加按钮
将以下代码加入 Joe/post.php 中
添加代码
<!-- Retractable sidebar -->
<?php if ($this->options->AsideStretch === 'on') : ?>
<div class="joe-stretch">
<div class="contain">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="M1024 894.976c0 71.68-51.2 129.024-114.688 129.024H116.736c-63.488 0-114.688-57.344-114.688-129.024V129.024C0 57.344 51.2 0 116.736 0h790.528c63.488 0 114.688 57.344 114.688 129.024v765.952zM987.136 155.648c0-65.536-47.104-118.784-106.496-118.784H145.408c-59.392 0-108.544 53.248-108.544 118.784v712.704c0 65.536 47.104 118.784 106.496 118.784h735.232c59.392 0 106.496-53.248 106.496-118.784V155.648z m0 0" p-id="17709"></path>
<path d="M923.648 288.768c0 32.768-24.576 57.344-55.296 57.344H165.888c-30.72 0-55.296-26.624-55.296-57.344V172.032c0-32.768 24.576-57.344 55.296-57.344h702.464c30.72 0 55.296 26.624 55.296 57.344v116.736z m0 0M638.976 851.968a57.344 57.344 0 0 1-57.344 57.344H169.984a57.344 57.344 0 0 1-57.344-57.344V475.136a57.344 57.344 0 0 1 57.344-57.344h411.648a57.344 57.344 0 0 1 57.344 57.344v376.832z m0 0M931.84 851.968a57.344 57.344 0 0 1-57.344 57.344h-112.64a57.344 57.344 0 0 1-57.344-57.344V475.136a57.344 57.344 0 0 1 57.344-57.344h112.64a57.344 57.344 0 0 1 57.344 57.344v376.832z m0 0" p-id="17710"></path>
</svg>
</div>
</div>
<?php endif; ?>添加位置
其他页面,如留言、Talk about and other pages are the same to add to the corresponding position on the line
三、添加JS和CSS
1、添加JS代码
在 Joe/assets/js/joe.post_page.min.js Add the following code before the last bracket
(Of course you can also add in Joe/assets/js/joe.post_page.js ,然后用minifyAfter the plugin is compressed, it can be replaced)
// Retractable sidebar
{
if ($(".joe_post div").hasClass("joe-stretch")) {
$(".joe-stretch .contain").css("top", $(".joe_header").height() + 40);
$(".joe-stretch").on("click", function () {
$(".joe_aside").toggleClass("inactive");
});
}
}2、添加css代码
在 Joe/assets/css/joe.post.min.css 内添加以下代码
.joe_aside.inactive{display:none}.joe_main{position:relative}@media(max-width: 768px){.joe-stretch{display:none}}.joe-stretch{height:100%;position:absolute;top:0;right:0;padding:40px 0}.joe-stretch .contain{position:-webkit-sticky;position:sticky;transition:top .5s;-webkit-animation:swingIconSet 2s infinite linear alternate;animation:swingIconSet 2s infinite linear alternate;z-index:333}@-webkit-keyframes swingIconSet{0%{transform:rotate(-30deg)}100%{transform:rotate(30deg)}}@keyframes swingIconSet{0%{transform:rotate(-30deg)}100%{transform:rotate(30deg)}}.joe-stretch .contain::before{content:"";position:absolute;top:0;left:0;width:10px;height:25px;border-top:2px solid var(--minor);border-right:2px solid var(--minor);transition:border .35s}.joe-stretch .contain svg{position:absolute;top:25px;left:-3px;width:24px;height:24px;fill:var(--minor);cursor:pointer;transition:fill .35s}.joe-stretch .contain:hover{-webkit-animation-play-state:paused;animation-play-state:paused}.joe-stretch .contain:hover svg{fill:var(--theme)}.joe-stretch .contain:hover::before{border-color:var(--theme)}.joe-stretch.active{display:block}结语
教程到这里就结束了,This tutorial is not onlyJoe主题可以使用,Can also be used on other themes,Just be flexible
没有固定的方法,Only fixed thinking,所以一定要多思考、Be flexible.
本文链接
边栏推荐
猜你喜欢

The Open-Closed Principle (OCP) of the Seven Principles of Software Design

一次多表关联顺序的慢查询——TiDB 关联特性

STM32H743IIT6 study notes 03 - using third-party components FreeRTOS

Flink调优
![[转载]卡尔曼滤波(kalman filter)和均值滤波有什么关系?](/img/9e/85cda1bbebf21af44eec93b495b428.png)
[转载]卡尔曼滤波(kalman filter)和均值滤波有什么关系?

What is the relationship between Kalman filter and mean filter?

一种3D视频格式转换(H264 MVC至SBS / OU)方案

嵌入式开发:嵌入式软件开发和编程

微信开发者工具更换默认用户存储目录方法,将C盘数据User Data迁移到D盘

松翰烧录器在keil仿真时闪退,解决方法
随机推荐
RK3568+Hongmeng Industrial Flat Panel Industrial Kanban Solution Design
Intronic Electronics IPO was terminated: annual revenue of 1 billion Shenzhen Venture Capital and Hongtu are shareholders
Metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
基于深度图的目标检测
高薪程序员&面试题精讲系列133之微服务里的网关有哪些实现方案?你熟悉Gateway网关吗?
对话庄表伟:开源第一课
后台权限系统的设计以及主流的五种权限模型详解
《MySQL核心知识》第2章:MySQL常用的命令
微信商城小程序怎么弄?怎么做微信商城小程序?
163_技巧_Power BI 一键批量建立自定义字段参数
The fourth SQL general command (DML)
How does the bank transaction system ensure strong consistency of data transactions?Via the database component?How to ensure the normal consistency of database transaction data under high concurrency?
VINS-Mono阅读先导篇
【Sequel Pro】下载查询结果乱码问题处理方式
《MySQL核心知识》第4章:简单语法
小程序开发商城的因素有哪些?
地平线初体验.下
C进阶 - 指针进阶
一次多表关联顺序的慢查询——TiDB 关联特性
我和TiDB的故事 | 遇上你是我的缘