Skip to content

Commit b8ac15a

Browse files
committed
Added back to top button
1 parent 4c23bb8 commit b8ac15a

File tree

1 file changed

+87
-1
lines changed

1 file changed

+87
-1
lines changed

resources/views/panel/config-editor.blade.php

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,72 @@
101101
transform: scale(1.1);
102102
}
103103
</style>
104+
<style>
105+
#button-top {
106+
display: inline-block;
107+
background-color: #275EFE;
108+
width: 50px;
109+
height: 50px;
110+
text-align: center;
111+
border-radius: 5px;
112+
position: fixed;
113+
bottom: 30px;
114+
right: 30px;
115+
transition: background-color .3s,
116+
opacity .5s, visibility .5s;
117+
opacity: 0;
118+
visibility: hidden;
119+
z-index: 1000;
120+
}
121+
#button-top::after {
122+
content: "\f077";
123+
font-family: FontAwesome;
124+
font-weight: normal;
125+
font-style: normal;
126+
font-size: 2em;
127+
line-height: 50px;
128+
color: #fff;
129+
}
130+
#button-top:hover {
131+
cursor: pointer;
132+
-webkit-filter: brightness(90%);
133+
}
134+
#button-top:active {
135+
background-color: #555;
136+
}
137+
#button-top.show {
138+
opacity: 1;
139+
visibility: visible;
140+
}
141+
142+
/* Styles for the content section */
143+
144+
.content {
145+
width: 77%;
146+
margin: 50px auto;
147+
font-family: 'Merriweather', serif;
148+
font-size: 17px;
149+
color: #6c767a;
150+
line-height: 1.9;
151+
}
152+
@media (min-width: 500px) {
153+
.content {
154+
width: 43%;
155+
}
156+
#button-top {
157+
margin: 30px;
158+
}
159+
}
160+
.content h1 {
161+
margin-bottom: -10px;
162+
color: #03a9f4;
163+
line-height: 1.5;
164+
}
165+
.content h3 {
166+
font-style: italic;
167+
color: #96a2a7;
168+
}
169+
</style>
104170

105171
<div class="option"><a href="?alternative-config">
106172
<div class="row"><i class="bi bi-pencil-square opt-img"></i><div>
@@ -178,12 +244,15 @@
178244

179245
</div>
180246
</div>
247+
248+
<!-- Back to top button -->
249+
<a id="button-top"></a>
250+
181251
@elseif($_SERVER['QUERY_STRING'] == 'alternative-config')
182252
@include('components.config.alternative-config')
183253
@include('components.config.back-button')
184254
@endif
185255

186-
187256
@push("sidebar-scripts")
188257
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
189258
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
@@ -203,6 +272,23 @@
203272
var hash = window.location.hash;
204273
$('#myTab a[href="' + hash + '"]').tab('show');
205274
</script>
275+
<script>
276+
var btn = $('#button-top');
277+
278+
$(window).scroll(function() {
279+
if ($(window).scrollTop() > 300) {
280+
btn.addClass('show');
281+
} else {
282+
btn.removeClass('show');
283+
}
284+
});
285+
286+
btn.on('click', function(e) {
287+
e.preventDefault();
288+
$('html, body').animate({scrollTop:250}, '300');
289+
});
290+
</script>
206291
@endpush
207292

293+
208294
@endsection

0 commit comments

Comments
 (0)