chore: initial import for test contour with k3s CI
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { Controller } from 'stimulus';
|
||||
|
||||
/*
|
||||
* This is an example Stimulus controller!
|
||||
*
|
||||
* Any element with a data-controller="default" attribute will cause
|
||||
* this controller to be executed. The name "default" comes from the filename:
|
||||
* default_controller.js -> "default"
|
||||
*
|
||||
* Delete this file or adapt it for your use!
|
||||
*/
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
var btn = this.element;
|
||||
|
||||
$(window).scroll(function() {
|
||||
if ($(window).scrollTop() > 300) {
|
||||
btn.classList.remove('d-none')
|
||||
} else {
|
||||
btn.classList.add('d-none')
|
||||
}
|
||||
});
|
||||
|
||||
btn.addEventListener('click', function(e) {
|
||||
$('html, body').animate({scrollTop:0}, '300');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user