ForgeComponents
en

Components

j-Sticker

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

Configuration:

  • on {String} this class is enabled when the scroll top position is greater than this element Y position
  • off {String} this class is enabled when the scroll top position is smaller than this element Y position
  • margin {Number} a margin which will be deducted from the top position of the current element
  • xs {Boolean} enables sticker for extra small display (default: false)
  • sm {Boolean} enables sticker for small display (default: true)
  • md {Boolean} enables sticker for medium display (default: true)
  • lg {Boolean} enables sticker for large display (default: true)
  • type {String} a method name for obtaining of position offset (default) or position
  • marginparent {Number} a margin for parent scrolling (default: 0)
  • parent {String} optional, a parent selector (look to example for understanding)
  • NEW: minheight {Number} a minimal height of scroll area for applying of classes

Use it with <ui-component name="sticker">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<style>
	.fixed { position: fixed; background-color: red; right: 0; top: 0; left: 0; padding: 20px 0; text-align: center; color: white; }
	.relative { background-color: blue; padding: 10px; border-radius: 4px; position: relative; display: inline-block; color: white; }
</style>

<div style="padding:50px; height:1500px">
	<div style="background-color:#F0F0F0;height:500px;margin:200px 0 0">
		<ui-component name="sticker" config="parent:parent" style="position:absolute">
			This text will depent on parent position.
		</ui-component>
	</div>
</div>
<hr />
<div style="padding:50px; height:1500px">
	<ui-component name="sticker" config="on:relative;off:fixed">
		This text will be on fixed position.
	</ui-component>
</div>