These always have to be inserted into the page option "Tracking Code" of the corresponding page, where you want to achieve the scrolling behavior.
Click: Page > Three Dot Menu > Tracking Code.
| Wert | Beschreibung |
|---|---|
CLICK_IMAGE_URL |
Address/URL of the image that shall start the scrolling on click. |
SCROLL_TO_CSS_SELECTOR |
Generic CSS selector identifying the element to scroll to. |
SCROLL_TO_ELEMENT_ID |
ID of a specific element to scroll to. |
SCROLL_TO_IMAGE_URL |
Address/URL of the image to scroll to. |
<script src="https://cdn.jsdelivr.net/gh/Perspective-Software/community-assets@1.1.0/scripts/clickToScroll.js"></script>
<script>
function psca_clickToScroll_init() {
psca_clickToScroll(
"CLICK_IMAGE_URL",
"bottom",
{ offset: 0, position: "center" }
);
}
</script><script src="https://cdn.jsdelivr.net/gh/Perspective-Software/community-assets@1.1.0/scripts/clickToScroll.js"></script>
<script>
function psca_clickToScroll_init() {
psca_clickToScroll(
"CLICK_IMAGE_URL",
"top",
{ offset: 0, position: "center" }
);
}
</script><script src="https://cdn.jsdelivr.net/gh/Perspective-Software/community-assets@1.1.0/scripts/clickToScroll.js"></script>
<script>
function psca_clickToScroll_init() {
psca_clickToScroll(
"CLICK_IMAGE_URL",
"SCROLL_TO_CSS_SELECTOR",
{ offset: 0, position: "center" }
);
}
</script><script src="https://cdn.jsdelivr.net/gh/Perspective-Software/community-assets@1.1.0/scripts/clickToScroll.js"></script>
<script>
function psca_clickToScroll_init() {
psca_clickToScroll(
"CLICK_IMAGE_URL",
"*[id='SCROLL_TO_ELEMENT_ID']",
{ offset: 0, position: "center" }
);
}
</script><script src="https://cdn.jsdelivr.net/gh/Perspective-Software/community-assets@1.1.0/scripts/clickToScroll.js"></script>
<script>
function psca_clickToScroll_init() {
psca_clickToScroll(
"CLICK_IMAGE_URL",
"SCROLL_TO_IMAGE_URL",
{ offset: 0, position: "center" }
);
}
</script>In the code example there is always the following:
... { offset: 0, position: "center"} ...
These are the scroll options:
offset:- Positive Zahl: Scrollt um
{offset}Pixel weiter nach oben. - Negative Zahl: Scrollt um
{offset}Pixel weniger weiter nach oben.
- Positive Zahl: Scrollt um
position:- Bestimmt, wo das Element, zu dem gescrollt werden soll, am Ende des Scrollens im Fenster positioniert sein soll.
- Mögliche Werte:
topcenterbottom