mirror of https://github.com/4xmen/xshop.git
parent
7051a0e40b
commit
c6ade855d2
@ -0,0 +1,3 @@
|
||||
<a id='SimpleGoTop' href="#">
|
||||
<i class="{{getSetting($data->area->name.'_'.$data->part.'_icon')}}"></i>
|
||||
</a>
|
@ -0,0 +1,8 @@
|
||||
const scrollBreakpoint = window.innerHeight * 0.2;
|
||||
window.addEventListener('scroll',function () {
|
||||
if (window.scrollY > scrollBreakpoint){
|
||||
document.querySelector('#SimpleGoTop').classList.add('show')
|
||||
}else{
|
||||
document.querySelector('#SimpleGoTop').classList.remove('show')
|
||||
}
|
||||
});
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "SimpleGoTop",
|
||||
"version": "1.0",
|
||||
"author": "xStack",
|
||||
"email": "xshop@xstack.ir",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"url": "https:\/\/xstack.ir",
|
||||
"author_url": "https:\/\/4xmen.ir",
|
||||
"packages": []
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Resources\Views\Segments;
|
||||
|
||||
use App\Models\Part;
|
||||
use App\Models\Setting;
|
||||
|
||||
class SimpleGoTop
|
||||
{
|
||||
public static function onAdd(Part $part = null)
|
||||
{
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_icon';
|
||||
$setting->value = 'ri-arrow-up-line';
|
||||
$setting->size = 12;
|
||||
$setting->type = 'ICON';
|
||||
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 6]);
|
||||
$setting->title = $part->area->name . ' ' . $part->part. ' icon ';
|
||||
$setting->save();
|
||||
}
|
||||
public static function onRemove(Part $part = null)
|
||||
{
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_icon')->first()?->delete();
|
||||
|
||||
}
|
||||
public static function onMount(Part $part = null)
|
||||
{
|
||||
return $part;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
#SimpleGoTop {
|
||||
position: fixed;
|
||||
bottom: 1rem;
|
||||
inset-inline-start: -100px;
|
||||
z-index: 999;
|
||||
background: var(--xshop-primary);
|
||||
width: 50px;
|
||||
border-radius: var(--xshop-border-radius);
|
||||
text-align: center;
|
||||
opacity: .5;
|
||||
transition: 400ms;
|
||||
i{
|
||||
color: var(--xshop-diff);
|
||||
font-size: 35px;
|
||||
}
|
||||
|
||||
&:hover{
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&.show{
|
||||
inset-inline-start: 1rem;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue