Skip to content

Instantly share code, notes, and snippets.

@Yan-Daojiang
Last active November 14, 2023 10:26
Show Gist options
  • Save Yan-Daojiang/381969d8249478beb7682dac4ece61d9 to your computer and use it in GitHub Desktop.
Save Yan-Daojiang/381969d8249478beb7682dac4ece61d9 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<style>
img {
max-width: 100%;
display: block;
}
figure.figurefx {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
transform: scale(0.8);
overflow: hidden;
margin: -40px auto;
}
figure.figurefx figcaption {
display: block;
box-sizing: border-box;
text-align: center;
font-family: "Montserrat";
width: 100%;
max-height: 100%;
left: 0;
color: #999;
font-size: 0.90rem;
}
figure.figurefx figcaption a {
text-decoration: none;
}
</style>
</head>
<body>
<figure class="figurefx">
<img src={{ .Get "url"}}>
<figcaption>{{ .Get "discribe"}}</figcaption>
</figure>
</body>
</html>
<style>
.douban-card {
background: var(--body-block-background-color-dark) !important;
box-shadow: 0 2px 4px rgb(0 0 0 / 25%), 0 0 2px rgb(0 0 0 / 25%);
}
.douban-card--rating {
color: var(--body-fore-color-dark);
}
.douban-card {
max-height: 12.6em;
margin: 1em auto;
position: relative;
display: flex;
background: #fff;
border-radius: 8px;
}
.douban-card a {
text-decoration: none;
border: none;
}
.douban-card--middle {
width: auto;
padding: 1.5em;
}
.douban-card--title {
font-size: 18px;
font-weight: bold;
max-height: 1.8em;
overflow: hidden;
}
.douban-card--tags {
font-size: 14px;
max-height: 1.8em;
line-height: 1.8em;
color: #999;
overflow: hidden;
}
.douban-card--summary {
font-size: 14px;
line-height: 1.8em;
max-height: 5.4em;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.douban-card--right {
min-width: 160px;
max-width: 160px;
float: right;
}
.douban-card--right img {
height: 100%;
width: 100%;
object-fit: cover;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
margin: 0;
}
@media (max-width:550px) {
.douban-card {
max-height: 11.2em;
}
.douban-card--right {
min-width: 0;
min-width: 40%;
width: 40%;
}
.douban-card--stars {
display: none !important;
}
.douban-card--tags {
max-height: 5.4em;
}
.douban-card--summary {
display: none;
}
}
.douban-card--stars-rating {
font-size: 14px;
max-height: 1.8em;
line-height: 1.8em;
overflow: hidden;
}
.douban-card--stars-rating span {
height: 1.5em;
line-height: 1.5em;
text-align: center;
display: inline-block;
}
.douban-card--logo-dou {
color: #FFF;
width: 1.5em;
background-color: #42BE57;
border: 1px solid #42BE57;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
display: inline-block;
}
.douban-card--logo-rating {
color: #42BE57;
width: 4.5em;
border: 1px solid #42BE57;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
display: inline-block;
}
.douban-card--stars {
width: 75px;
height: 15px !important;
background-image: url(/images/icons/douban-stars.png);
background-image: -webkit-image-set(url(/images/icons/douban-stars.png) 1x, url(/images/icons/douban-stars@2x.png) 2x);
background-image: -moz-image-set(url(/images/icons/douban-stars.png) 1x, url(/images/icons/douban-stars@2x.png) 2x);
background-image: -o-image-set(url(/images/icons/douban-stars.png) 1x, url(/images/icons/douban-stars@2x.png) 2x);
background-image: -ms-image-set(url(/images/icons/douban-stars.png) 1x, url(/images/icons/douban-stars@2x.png) 2x);
overflow: hidden;
margin-left: .6em;
vertical-align: text-top;
}
.douban-card--rating {
color: #777;
font-weight: bold;
margin-left: .6em;
}
.douban-card--stars-10 {
background-position: 0px 0px;
}
.douban-card--stars-9 {
background-position: 0px -15px;
}
.douban-card--stars-8 {
background-position: 0px -30px;
}
.douban-card--stars-7 {
background-position: 0px -45px;
}
.douban-card--stars-6 {
background-position: 0px -60px;
}
.douban-card--stars-5 {
background-position: 0px -75px;
}
.douban-card--stars-4 {
background-position: 0px -90px;
}
.douban-card--stars-3 {
background-position: 0px -105px;
}
.douban-card--stars-2 {
background-position: 0px -120px;
}
.douban-card--stars-1 {
background-position: 0px -135px;
}
.douban-card--stars-0 {
background-position: 0px -150px;
}
</style>
{{ $dbUrl := .Get 0 }}
{{ $dbType := replaceRE `https://(movie|book).douban.com/subject/.*` "$1" $dbUrl }}
{{ $dbID := replaceRE `.*douban.com/subject/([0-9]+)/.*` "$1" $dbUrl }}
{{ if eq $dbType "book" }}
{{$items := getCSV "," "static/data/douban/book.csv" }}
{{range $item := $items}}
{{if eq (index $item 5) $dbUrl }}
{{ $rating := float (index $item 6) }}
<div class="douban-card douban-card-book" id="douban-card-book"+{{$dbID}} douban-id={{$dbID}}>
<div class="douban-card--middle">
<div class="douban-card--title">
<a href="{{ index $item 5 }}" class="cute" target="_blank" rel="external nofollow">{{ index $item 1 }}</a>
</div>
<div class="douban-card--stars-rating">
<span class="douban-card--logo-dou">豆</span><span class="douban-card--logo-rating">豆瓣评分</span>
<span class="douban-card--stars douban-card--stars-' + stars + '"></span>
<span class="douban-card--rating">{{$rating}}</span>
</div>
<div class="douban-card--tags">{{ index $item 12 }}</div>
<div class="douban-card--summary">{{ index $item 2}}</div>
</div>
<div class="douban-card--right">
<img src="{{ index $item 3 }}" referrerPolicy="no-referrer" />
</div>
</div>
{{end}}
{{end}}
{{ end }}
{{ if eq $dbType "movie" }}
{{$items := getCSV "," "static/data/douban/movie.csv" }}
{{range $item := $items}}
{{if eq (index $item 5) $dbUrl }}
{{ $rating := float (index $item 6) }}
<div class="douban-card douban-card-movie" id="douban-card-movie"+{{$dbID}} douban-id={{$dbID}}>
<div class="douban-card--middle">
<div class="douban-card--title">
<a href="{{ index $item 5 }}" target="_blank"> {{ index $item 1 }} </a>
</div>
<div class="douban-card--stars-rating">
<span class="douban-card--logo-dou">豆</span><span class="douban-card--logo-rating">豆瓣评分</span>
<span class="douban-card--stars douban-card--stars-' + stars + '"></span>
<span class="douban-card--rating">{{$rating}}</span>
</div>
<div class="douban-card--tags"> {{ index $item 12 }}</div>
<div class="douban-card--summary">{{ $.Get 1 }}</div>
</div>
<div class="douban-card--right">
<img src="{{ index $item 3 }}" referrerPolicy="no-referrer" />
</div>
</div>
{{end}}
{{end}}
{{ end }}

图片

{{< card url="https://file.yandaojiang.com/blog/images/Riho_Takada_%E9%AB%98%E7%94%B0%E9%87%8C%E7%A9%82%2C_%5BWPB-net%5D_%E3%81%B2%E3%81%8B%E3%82%8A%E8%BC%9D%E3%81%8F%E6%99%82%E9%96%93%E3%81%AE%E4%B8%AD%E3%81%A7_Set.04_%E2%80%93_Everia.club_10227.jpg" discribe="图1. 通过 Hugo shortcode 插入图片,并在图片底部加入图片描述">}}

Youtube & Bibili

参考 https://www.sulvblog.cn/posts/blog/shortcodes/#2-%E5%BC%95%E5%85%A5-bilibili-%E8%A7%86%E9%A2%91

Podcast / Music

{{< music audio="https://file.yandaojiang.com/blog/music/topgun.mp3" img="https://file.yandaojiang.com/blog/music/1.png" title="Hold My Hand" author="Lady Gaga">}}

豆瓣条目

使用的本地数据 {{< douban-card type="book" id="33474750" >}} shortcodes: https://gist.github.com/Yan-Daojiang/14e6215e628931d295a7c934fa754b89

最近内容 参考:https://immmmm.com/hugo-shortcodes-recently-by-douban/

博客内链

参考:https://www.sulvblog.cn/posts/blog/shortcodes/#4-%e5%bc%95%e5%85%a5%e5%8d%9a%e5%ae%a2%e6%96%87%e7%ab%a0%e5%86%85%e9%93%be

终端

{{< terminal "yandaojiang@Daojiang-macbook-pro" >}} [ydj-macbook-pro ~ % wget google.com --2023-01-28 16:21:18-- http://google.com/ 正在解析主机 google.com (google.com)... 198.18.4.194 正在连接 google.com (google.com)|198.18.4.194|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 301 Moved Permanently 位置:http://www.google.com/ [跟随至新的 URL] --2023-01-28 16:21:18-- http://www.google.com/ 正在解析主机 www.google.com (www.google.com)... 198.18.0.13 正在连接 www.google.com (www.google.com)|198.18.0.13|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:未指定 [text/html] 正在保存至: “index.html”

index.html [ <=> ] 14.67K --.-KB/s 用时 0.07s

2023-01-28 16:21:19 (209 KB/s) - “index.html” 已保存 [15021] [ydj-macbook-pro ~ % {{< /terminal >}}

Timeline

目前只实现了效果,没有优化shortcodes. {{< timeline >}}

2022.12-2023.12

盼望着,盼望着,东风来了,春天的脚步近了。一切都像刚睡醒的样子,欣欣然张开了眼。山朗润起来了,水涨起来了,太阳的脸红起来了。小草偷偷地从土里钻出来,嫩嫩的,绿绿的。园子里,田野里,瞧去,一大片一大片满是的。坐着,躺着,打两个滚,踢几脚球,赛几趟跑,捉几回迷藏。风轻悄悄的,草软绵绵的。

TCMalloc

2022.05.06

This repository contains the TCMalloc C++ code.TCMalloc is Google’s customized implementation of C’s malloc() and C++’s operator new used for memory allocation within our C and C++ code. TCMalloc is a fast, multi-threaded malloc implementation.

More

TCMalloc

2022.05.06

This repository contains the TCMalloc C++ code.TCMalloc is Google’s customized implementation of C’s malloc() and C++’s operator new used for memory allocation within our C and C++ code. TCMalloc is a fast, multi-threaded malloc implementation.

More

{{< /timeline >}}

图片瀑布流

参考:https://immmmm.com/hugo-readdir-photos/

图片滑块

{{< gallery-slider cos="https://blog-files.yandaojiang.com/" dir="/posts_images/posts/tech/others/hugo_shortcodes示例/slider-examples" auto-slide="2000">}}

图片动态展示

{{< images group_name="gg" mainImg="https://blog-files.yandaojiang.com/posts_images/posts/tech/others/hugo_shortcodes示例/gallery/0.jpg" cos="https://blog-files.yandaojiang.com/" dir="posts_images/posts/tech/others/hugo_shortcodes示例/gallery/in-gallery/" >}}

<!DOCTYPE html>
<html lang="en">
<head>
<style>
.w {
width:50vmin;
height:80vmin;
margin: auto;
}
.ts {
width:100%; height:100%;
position:relative;
--barH:10%;/*active zone height = 100% - barH*/
}
.t {
--w:20%;
display:block; width:var(--w); height:var(--barH);
position:absolute; bottom:0; left:var(--l);
transform-origin:top left;
}
.t img {
width:100%; height:100%;
-o-object-fit:cover;
object-fit:cover;
transform:scale(0.8);
}
[type="radio"] {
display:none;
}
:checked + label.t {
left:0; bottom:var(--barH);
height:calc(100% - var(--barH));
}
:checked + label.t img {
-o-object-fit:contain;
object-fit:contain;
}
/*
optional
*/
.ts {/*thumbnails bar*/
perspective:100px;
perspective-origin:center center;
transform-style:preserve-3d;
pointer-events:none;
}
.ts:after {/*the plate*/
content:"";
display:block; width:100%; height:15px;
position:absolute; bottom:0;
background:linear-gradient(transparent 20%, rgba(0,0,0,0.1));
transform:rotateX(90deg)scaleX(1.2);
transform-origin:bottom center;
}
:not(:checked) + .t {/*inactive labels*/
transform:translate3d(0, 0, -5px);
pointer-events:auto;
}
:not(:checked) + .t:hover {
transform:translate3d(0, -7px, -5px);
box-shadow:0 30px 30px -25px rgba(0,0,0,0.3);
cursor:pointer;
}
:not(:checked) + .t img {
transform:scale(0.9);/*create gaps*/
}
:checked + .t {/*active label*/
box-shadow:0 0 0 transparent;
-webkit-animation:anim 2s 1;
animation:anim 2s 1;
} @-webkit-keyframes anim {
from { transform:rotateY(6deg)rotateX(3deg) }
} @keyframes anim {
from { transform:rotateY(6deg)rotateX(3deg) }
}
/*
transitions
*/
.t {/*active->inactive & hover->rest*/
transition:transform 0.5s, bottom 0.6s, left 0.6s, width 0.3s, box-shadow 1s;
}
.t:hover, :checked + .t {
transition:transform 0.5s, bottom 0.6s, left 0.6s, width 0.3s, box-shadow 0s;
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<div class="w">
<div class="ts">
{{- $group_name := print ($.Get "group_name")}}
{{- $temp := print "?ixlib=rb-0.3.5&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;s=4c747db3353a34b312d05786f47930d3&amp;auto=format&amp;fit=crop&amp;w=600&amp;q=60"}}
<input type="radio" id={{ .Get "mainImg" }} name={{ $group_name}} checked="checked"/>
<label class="t" for={{ .Get "mainImg" }}><img src={{ print ($.Get "mainImg") $temp}}/></label>
{{- with (.Get "dir") -}}
{{- $files := readDir (print "/static/" .) }}
{{- range $files -}}
{{- $cosurl := print ($.Get "cos")}}
{{- $absoluteUrl := print $cosurl ($.Get "dir") "/" .Name $temp}}
<input type="radio" id={{ $absoluteUrl }} name={{ $group_name}} />
<label class="t" for={{ $absoluteUrl }}><img src={{ $absoluteUrl }}/></label>
{{- end }}
{{- end }}
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel='stylesheet' href='https://icono-49d6.kxcdn.com/icono.min.css'>
<style>
.audio-player {
height: 50px;
width: 100%;
background: #444;
font-family: arial;
color: white;
font-size: 0.75em;
overflow: hidden;
margin: auto;
display: grid;
grid-template-rows: 6px auto;
border-radius: 10px;
}
.audio-player .timeline {
background: rgb(159, 146, 146);
width: 100%;
position: relative;
cursor: pointer;
box-shadow: 0 2px 10px 0 #0008;
}
.audio-player .timeline .progress {
background: coral;
width: 0%;
height: 100%;
transition: 0.25s;
}
.audio-player .controls {
display: flex;
justify-content: space-between;
align-items: stretch;
padding: 0 20px;
}
.audio-player .controls > * {
display: flex;
justify-content: center;
align-items: center;
}
.audio-player .controls .toggle-play.play {
cursor: pointer;
position: relative;
left: 0;
height: 0;
width: 0;
border: 7px solid #0000;
border-left: 13px solid white;
}
.audio-player .controls .toggle-play.play:hover {
transform: scale(1.1);
}
.audio-player .controls .toggle-play.pause {
height: 15px;
width: 20px;
cursor: pointer;
position: relative;
}
.audio-player .controls .toggle-play.pause:before {
position: absolute;
top: 0;
left: 0px;
background: white;
content: "";
height: 15px;
width: 3px;
}
.audio-player .controls .toggle-play.pause:after {
position: absolute;
top: 0;
right: 8px;
background: white;
content: "";
height: 15px;
width: 3px;
}
.audio-player .controls .toggle-play.pause:hover {
transform: scale(1.1);
}
.audio-player .controls .time {
display: flex;
}
.audio-player .controls .time > * {
padding: 2px;
}
.audio-player .controls .volume-container {
cursor: pointer;
position: relative;
z-index: 2;
}
.audio-player .controls .volume-container .volume-button {
height: 26px;
display: flex;
align-items: center;
margin: auto;
}
.audio-player .controls .volume-container .volume-button .volume {
transform: scale(0.6);
}
.audio-player .controls .volume-container .volume-slider {
position: absolute;
left: -3px;
top: 15px;
z-index: -1;
width: 0;
height: 15px;
background: white;
box-shadow: 0 0 20px #000a;
transition: 0.25s;
}
.audio-player .controls .volume-container .volume-slider .volume-percentage {
background: coral;
height: 100%;
width: 75%;
}
.audio-player .controls .volume-container:hover .volume-slider {
left: -123px;
width: 120px;
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<div class="audio-player">
<div class="timeline">
<div class="progress"></div>
</div>
<div class="controls">
<div class="play-container">
<div class="toggle-play play">
</div>
</div>
<div class="time">
<div class="current">0:00</div>
<div class="divider">/</div>
<div class="length"></div>
</div>
<div class="name">{{ .Get "name"}}</div>
<div class="volume-container">
<div class="volume-button">
<div class="volume icono-volumeHigh"></div>
</div>
<div class="volume-slider">
<div class="volume-percentage"></div>
</div>
</div>
</div>
</div>
<!-- partial -->
<script>
const audioPlayer = document.querySelector(".audio-player");
const audio = new Audio(
{{ .Get "url"}}
);
console.dir(audio);
audio.addEventListener(
"loadeddata",
() => {
audioPlayer.querySelector(".time .length").textContent = getTimeCodeFromNum(
audio.duration
);
audio.volume = .75;
},
false
);
//click on timeline to skip around
const timeline = audioPlayer.querySelector(".timeline");
timeline.addEventListener("click", e => {
const timelineWidth = window.getComputedStyle(timeline).width;
const timeToSeek = e.offsetX / parseInt(timelineWidth) * audio.duration;
audio.currentTime = timeToSeek;
}, false);
//click volume slider to change volume
const volumeSlider = audioPlayer.querySelector(".controls .volume-slider");
volumeSlider.addEventListener('click', e => {
const sliderWidth = window.getComputedStyle(volumeSlider).width;
const newVolume = e.offsetX / parseInt(sliderWidth);
audio.volume = newVolume;
audioPlayer.querySelector(".controls .volume-percentage").style.width = newVolume * 100 + '%';
}, false)
//check audio percentage and update time accordingly
setInterval(() => {
const progressBar = audioPlayer.querySelector(".progress");
progressBar.style.width = audio.currentTime / audio.duration * 100 + "%";
audioPlayer.querySelector(".time .current").textContent = getTimeCodeFromNum(
audio.currentTime
);
}, 500);
//toggle between playing and pausing on button click
const playBtn = audioPlayer.querySelector(".controls .toggle-play");
playBtn.addEventListener(
"click",
() => {
if (audio.paused) {
playBtn.classList.remove("play");
playBtn.classList.add("pause");
audio.play();
} else {
playBtn.classList.remove("pause");
playBtn.classList.add("play");
audio.pause();
}
},
false
);
audioPlayer.querySelector(".volume-button").addEventListener("click", () => {
const volumeEl = audioPlayer.querySelector(".volume-container .volume");
audio.muted = !audio.muted;
if (audio.muted) {
volumeEl.classList.remove("icono-volumeHigh");
volumeEl.classList.add("icono-volumeMute");
} else {
volumeEl.classList.add("icono-volumeHigh");
volumeEl.classList.remove("icono-volumeMute");
}
});
//turn 128 seconds into 2:08
function getTimeCodeFromNum(num) {
let seconds = parseInt(num);
let minutes = parseInt(seconds / 60);
seconds -= minutes * 60;
const hours = parseInt(minutes / 60);
minutes -= hours * 60;
if (hours === 0) return `${minutes}:${String(seconds % 60).padStart(2, 0)}`;
return `${String(hours).padStart(2, 0)}:${minutes}:${String(
seconds % 60
).padStart(2, 0)}`;
}
</script>
</body>
</html>
<div class="window">
<div class="titlebar">
<div class="buttons">
<div class="bclose">
<a class="closebutton" href="#"><span><strong>x</strong></span></a>
</div>
<div class="minimize">
<a class="minimizebutton" href="#"><span><strong>&ndash;</strong></span></a>
</div>
<div class="zoom">
<a class="zoombutton" href="#"><span><strong>+</strong></span></a>
</div>
</div>
{{ .Get 0 }}: {{ .Get 1 }}
</div>
<div class="terminal">
<ul>
{{ range split .Inner "\n" }}
{{ $line := replace . " " "&nbsp;" }}
<li>{{ printf "%s" $line | safeHTML }}</li>
{{ end }}
</ul>
</div>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css?family=Roboto:100i,300,400,500,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Allura" rel="stylesheet">
<style>
.ttimeline {
position: relative;
}
.ttimeline::before {
content: "";
background: #C5CAE9;
width: 5px;
height: 95%;
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.timeline-item {
width: 100%;
margin-bottom: 70px;
}
.timeline-item:nth-child(even) .timeline-content {
float: right;
padding: 40px 30px 10px 30px;
}
.timeline-item:nth-child(even) .timeline-content .date {
right: auto;
left: 0;
}
.timeline-item:nth-child(even) .timeline-content::after {
content: "";
position: absolute;
border-style: solid;
width: 0;
height: 0;
top: 30px;
left: -15px;
border-width: 10px 15px 10px 0;
border-color: transparent var(--entry) transparent transparent;
}
.timeline-item::after {
content: "";
display: block;
clear: both;
}
.timeline-content {
position: relative;
width: 43%;
padding: 10px 30px;
border-radius: 4px;
background: var(--entry);
box-shadow: 0 20px 25px -15px rgba(0, 0, 0, 0.3);
}
.timeline-content::after {
content: "";
position: absolute;
border-style: solid;
width: 0;
height: 0;
top: 30px;
right: -15px;
border-width: 10px 0 10px 15px;
border-color: transparent transparent transparent var(--entry);
}
.timeline-img {
width: 30px;
height: 30px;
background: #3F51B5;
border-radius: 50%;
position: absolute;
left: 50%;
margin-top: 25px;
margin-left: -15px;
}
.timeline-text {
font-size: 13px;
}
.bnt-more {
background: #3F51B5;
color: #FFFFFF;
padding: 8px 20px;
text-transform: uppercase;
font-size: 14px;
margin-bottom: 20px;
margin-top: 10px;
display: inline-block;
border-radius: 2px;
box-shadow: 0 1px 3px -1000px rgba(0, 0, 0, 0.6);
}
.timeline-card {
padding: 0 !important;
}
.timeline-card p {
padding: 0 20px;
}
.timeline-card a {
margin-left: 20px;
}
.timeline-item .timeline-img-header {
background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4)), center center no-repeat;
background-size: cover;
}
.timeline-img-header {
height: 200px;
position: relative;
margin-bottom: 20px;
}
.timeline-img-header p {
position: absolute;
bottom: 5px;
left: 20px;
font-size: 24px;
}
.timeline-header {
font-size: 24px;
}
.date {
background: #FF4081;
display: inline-block;
color: #FFFFFF;
padding: 10px;
position: absolute;
top: 0;
right: 0;
}
@media screen and (max-width: 768px) {
.ttimeline::before {
left: 50px;
}
.ttimeline .timeline-img {
left: 50px;
}
.ttimeline .timeline-content {
max-width: 100%;
width: auto;
margin-left: 82px;
}
.ttimeline .timeline-item:nth-child(even) .timeline-content {
float: none;
}
.ttimeline .timeline-item:nth-child(odd) .timeline-content::after {
content: "";
position: absolute;
border-style: solid;
width: 0;
height: 0;
top: 30px;
left: -15px;
border-width: 10px 15px 10px 0;
border-color: transparent var(--entry) transparent transparent;
}
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<section class="ttimeline">
<div class="container">
{{ .Get 0 }}
{{ range split .Inner "\n" }}
{{ $line := replace . " " " " }}
{{ printf "%s" $line | safeHTML }}
{{ end }}
</div>
</section>
<!-- partial -->
<script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
<script src='https://cdn.jsdelivr.net/scrollreveal.js/3.3.1/scrollreveal.min.js'></script>
<script>
$(function () {
window.sr = ScrollReveal();
if ($(window).width() < 768) {
if ($('.timeline-content').hasClass('js--fadeInLeft')) {
$('.timeline-content').removeClass('js--fadeInLeft').addClass('js--fadeInRight');
}
sr.reveal('.js--fadeInRight', {
origin: 'bottom',
distance: '300px',
easing: 'ease-in-out',
duration: 800,
});
} else {
sr.reveal('.js--fadeInLeft', {
origin: 'left',
distance: '300px',
easing: 'ease-in-out',
duration: 800,
});
sr.reveal('.js--fadeInRight', {
origin: 'right',
distance: '300px',
easing: 'ease-in-out',
duration: 800,
});
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment