Skip to content

Commit 930c01f

Browse files
committed
Merge remote-tracking branch 'origin/css-style'
2 parents 4eb0607 + 142929c commit 930c01f

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

tutorial.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,29 @@ div.tright, div.floatright, table.floatright {
128128
border: medium none !important;
129129
direction: ltr;
130130
}
131+
132+
.backtop-box {
133+
position: fixed; left: 180px; bottom: 20px;
134+
}
135+
.backtop-box b {
136+
display: block; cursor: pointer;
137+
width: 40px; height: 40px;
138+
opacity: 0;
139+
background: #fff;;
140+
text-align: center;
141+
border: 1px solid #aaa;
142+
border-radius: 18px 2px 2px 2px;
143+
-moz-border-radius: 18px 2px 2px 2px;
144+
-webkit-border-radius: 18px 2px 2px 2px;
145+
-o-border-radius: 18px 2px 2px 2px;
146+
-ms-border-radius: 18px 2px 2px 2px;
147+
line-height: 40px;
148+
color: #666;
149+
}
150+
.backtop-box b:hover {
151+
background: #eee;
152+
}
153+
.backtop-box-show b {
154+
opacity: 1;
155+
}
156+

utils/gen-html-index-en.pl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,41 @@
103103

104104
$res .= "</section>\n";
105105

106+
$res .= <<_EOC_;
107+
<script>
108+
function init_back_top() {
109+
function _fn() {
110+
var t = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
111+
if (t > 5) {
112+
if (! show) {
113+
show = true;
114+
r.className = 'backtop-box-show';
115+
}
116+
} else {
117+
if (show) {
118+
show = false;
119+
r.className = '';
120+
}
121+
}
122+
}
123+
124+
var r = document.createElement('div');
125+
document.body.appendChild(r);
126+
r.innerHTML = '<div class="backtop-box"><b title="Jump to Top of Page">Top</b></div>';
127+
128+
var show = false;
129+
r.onclick = function() {
130+
window.scrollTo(0, 0);
131+
};
132+
133+
window.onscroll = _fn;
134+
window.onresize = _fn;
135+
}
136+
137+
init_back_top();
138+
</script>
139+
_EOC_
140+
106141
$res .= "</body></html>";
107142

108143
if ($outfile) {

0 commit comments

Comments
 (0)