2.7.0 • Published 3 years ago

@inotom/sws-gotop v2.7.0

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

sws-gotop

A web components to display the button to scroll to the top of the page.

Demo

Demo

Usage

Place sws-gotop custom element.

<sws-gotop></sws-gotop>
<script type="module" src="sws-gotop.min.js" defer></script>

Set element's style etc... by css custom properties.

sws-gotop {
  --sws-gotop-position: fixed;
  --sws-gotop-size: 80px;
  --sws-gotop-aspect-ratio: 1;
  --sws-gotop-top: initial;
  --sws-gotop-left: initial;
  --sws-gotop-right: 50px;
  --sws-gotop-bottom: 100px;
  --sws-gotop-z-index: 1000;
  --sws-gotop-transition: opacity 0.3s, transform 0.3s;
  --sws-gotop-transform: translate3d(0, 50px, 0);
  --sws-gotop-fg-color: #fff;
  --sws-gotop-bg-color: #933;
  --sws-gotop-hover-opacity: 1;
  --sws-gotop-border-radius: 50%;
  --sws-gotop-border: 0 none;
  --sws-gotop-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
  --sws-gotop-ripple-color: rgba(255, 255, 255, 0.5);
  --sws-gotop-ripple-border-radius: 50%;
  --sws-gotop-arrow-color: #fff;
  --sws-gotop-arrow-weight: 2px;
  --sws-gotop-arrow-scale: 1;
  --sws-gotop-pointer-focus-outline-width: 0;
  --sws-gotop-svg-max-width: 100%;
  --sws-gotop-image-object-fit: cover;
}

CSS custom properties

css custom property namecontentdefaults
--sws-gotop-positionPositionfixed
--sws-gotop-sizeHorizontal size (width)80px
--sws-gotop-aspect-ratioAspect ratio size1
--sws-gotop-topPosition from the top edge of the windowinitial
--sws-gotop-leftPosition from the left edge of the windowinitial
--sws-gotop-rightPosition from the right edge of the window50px
--sws-gotop-bottomPosition from the bottom of window100px
--sws-gotop-z-indexValue of z-index1000
--sws-gotop-transitionShow in transitionopacity 0.3s, transform 0.3s
--sws-gotop-transformMove button position before show intranslate3d(0, 50px, 0)
--sws-gotop-fg-colorForeground color#fff
--sws-gotop-bg-colorBackground color#933
--sws-gotop-hover-opacityTransparency with mouse over1
--sws-gotop-border-radiusBorder radius size50%
--sws-gotop-borderBorder style0 none
--sws-gotop-shadowButton shadow style2px 2px 5px rgba(0, 0, 0, 0.2)
--sws-gotop-ripple-colorRipple effect colorrgba(255, 255, 255, 0.5)
--sws-gotop-ripple-border-radiusRipple border radius size50%
--sws-gotop-arrow-colorArrow color#fff
--sws-gotop-arrow-weightThickness of the arrow2px
--sws-gotop-arrow-scaleScale size of the arrow1
--sws-gotop-pointer-focus-outline-widthMouse pointer Fouced outline width0
--sws-gotop-svg-max-widthArrow svg image max width100%
--sws-gotop-image-object-fitImage object fit propertycover

Options

<sws-gotop
  boundary="200"
  src="button.png"
  media="(max-width: 768px)"
  label="Go to page top"
  index="0"
></sws-gotop>
option namecontentdefaults
boundaryScroll position to start display200
srcImage path''
mediaMobile device judgment width(max-width: 768px)
labelaria-label text''
indextabindex value0
modeSelect inner content, svg or slotsvg

License

MIT

Author

inotom

2.7.0

3 years ago

2.6.0

3 years ago

2.5.0

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

5 years ago

2.0.0

5 years ago