Theme
Waypoint
Funny example of Waypoints within scrollable non-window elements. The Waypoint component utilizes the "forContext" attribute and is used in combination with pe:javascript.

Font Size:

  • 8px
  • 10px
  • 12px
  • 14px
  • 16px
  • 18px
  • 24px
  • 36px
  • 48px
  • 72px

Width:

  • 150px
  • 200px
  • 250px
  • 300px
  • 350px
  • 400px
  • 500px
  • 600px
  • 700px
  • 800px
  • 1024px
  • 1280px

BG Color:

  • #fff
  • #d1f2a5
  • #effab4
  • #ffc48c
  • #ff9f80
  • #f56991
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur blandit ultrices rutrum. Cras dignissim purus non purus mattis nec lobortis enim dignissim. Nulla a urna est. Proin volutpat odio id velit tempor sollicitudin. Aliquam lobortis nunc gravida orci fringilla in commodo lectus gravida. In hac habitasse platea dictumst. Maecenas tincidunt pulvinar blandit. Suspendisse a diam ligula. Mauris non tellus nisl, in interdum elit. Etiam rhoncus cursus lectus vel venenatis. Nulla facilisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer eleifend imperdiet lectus vitae aliquet. Mauris metus lorem, fermentum vitae malesuada quis, pretium id mi.
Source

<h:panelGroup id="wrapper" layout="block">
    <div data-property="font-size" class="dial first">
        <h3>Font Size:</h3>
        <ul>
            <li data-value="8px">8px</li>
            <li data-value="10px">10px</li>
            <li data-value="12px">12px</li>
            <li data-value="14px">14px</li>
            <li data-value="16px">16px</li>
            <li data-value="18px">18px</li>
            <li data-value="24px">24px</li>
            <li data-value="36px">36px</li>
            <li data-value="48px">48px</li>
            <li data-value="72px">72px</li>
        </ul>
        <div class="indicator"></div>
    </div>
    <div data-property="width" class="dial">
        <h3>Width:</h3>
        <ul>
            <li data-value="150px">150px</li>
            <li data-value="200px">200px</li>
            <li data-value="250px">250px</li>
            <li data-value="300px">300px</li>
            <li data-value="350px">350px</li>
            <li data-value="400px">400px</li>
            <li data-value="500px">500px</li>
            <li data-value="600px">600px</li>
            <li data-value="700px">700px</li>
            <li data-value="800px">800px</li>
            <li data-value="1024px">1024px</li>
            <li data-value="1280px">1280px</li>
        </ul>
        <div class="indicator"></div>
    </div>
    <div data-property="background-color" class="dial">
        <h3>BG Color:</h3>
        <ul>
            <li data-value="#fff">#fff</li>
            <li data-value="#d1f2a5">#d1f2a5</li>
            <li data-value="#effab4">#effab4</li>
            <li data-value="#ffc48c">#ffc48c</li>
            <li data-value="#ff9f80">#ff9f80</li>
            <li data-value="#f56991">#f56991</li>
        </ul>
        <div class="indicator"></div>
    </div>
</h:panelGroup>
    
<h:panelGroup id="textContainer" layout="block">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur blandit ultrices rutrum. Cras dignissim purus non purus
    mattis nec lobortis enim dignissim. Nulla a urna est. Proin volutpat odio id velit tempor sollicitudin. Aliquam lobortis
    nunc gravida orci fringilla in commodo lectus gravida. In hac habitasse platea dictumst. Maecenas tincidunt pulvinar
    blandit. Suspendisse a diam ligula. Mauris non tellus nisl, in interdum elit. Etiam rhoncus cursus lectus vel venenatis.
    Nulla facilisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer
    eleifend imperdiet lectus vitae aliquet. Mauris metus lorem, fermentum vitae malesuada quis, pretium id mi.
</h:panelGroup>    

<pe:waypoint id="waypoint" for="@(.dial li)" forContext="@(.dial ul)" offset="25">
    <pe:javascript event="reached" execute="handleWaypoint(ext);"/>
</pe:waypoint>
    
<h:outputScript id="waypointScript" target="body">
/* <![CDATA[ */
    function handleWaypoint(ext) {
        var $active = $(ext.waypoint);

        if (ext.direction === "up") {
            $active = $active.prev();
        }
        
        if (!$active.length) $active.end();
        
        var cssProperty = $active.closest('.dial').data('property');
        var cssValue = $active.data('value');
        
        if (cssProperty && cssValue) {
            $('#textContainer').css(cssProperty, cssValue);
        }
    }
/* ]]> */
</h:outputScript>

<h:outputStylesheet id="waypointCSS">
    #wrapper {
        width: 460px;
        margin: 0 auto 0 auto;
        overflow: hidden;
    }
    
    .dial {
        float: left;
        width: 140px;
        margin-left: 20px;
        position: relative;
    }
    
    .dial.first {
        margin-left: 0;
    }
    
    .dial h2 {
        font-weight: bold;
    }
    
    .dial ul {
        background: #fff;
        border: 1px solid #bbb;
        padding: 25px 0 114px 0;
        height: 1px;
        overflow-y: scroll;
        margin: 0;
    }
    
    .dial ul:before {
        content: "";
        border: 10px solid #555;
        width: 1px;
        height: 1px;
        display: block;
        position: absolute;
        bottom: 105px;
        left: 0;
        z-index: 3;
        border-top-color: transparent;
        border-right-color: transparent;
        border-bottom-color: transparent;
    }
    
    .dial li {
        height: 20px;
        line-height: 20px;
        padding: 10px 10px 10px 20px;
        border-bottom: 1px solid #ddd;
        font-size: 20px;
        margin: 0;
    }
    
    .dial li:first-child {
        border-top: 1px solid #ddd;
    }
    
    li[data-value="#fff"] {
        background: #fff;
    }
    li[data-value="#d1f2a5"] {
        background: #d1f2a5;
    }
    li[data-value="#effab4"] {
        background: #effab4;
    }
    li[data-value="#ffc48c"] {
        background: #ffc48c;
    }
    li[data-value="#ff9f80"] {
        background: #ff9f80;
    }
    li[data-value="#f56991"] {
        background: #f56991;
    }
    
    .indicator {
        position: absolute;
        bottom: 115px;
        left: 0;
        height: 1px;
        width: 120px;
        background: red;
    }
    
    #textContainer {
        font-size: 8px;
        line-height: 1.5;
        width: 150px;
        background: #fff;
        border: 1px solid #ccc;
        margin: 15px auto auto auto;
        padding: 10px;
        -webkit-transition: all 500ms ease-in-out;
        -moz-transition: all 500ms ease-in-out;
        -ms-transition: all 500ms ease-in-out;
        transition: all 500ms ease-in-out;
    }
</h:outputStylesheet>
            
Components and more
Documentation pe:waypoint
Attributes (move mouse over the names to see data types)
Name Description
id Unique identifier of the component in a namingContainer.
rendered Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar Name of the client side widget.
for The target component registered as waypoint. If null, the parent component will be taken as target. Default is null.
forContext The context defines which scrollable element the waypoint belongs to and acts within. It can be a component or plain HTML element like a div. Default is window if nothing specified.
enabled If false, this waypoint will be created but will be disabled from triggering. You can call widget's method "enable" to turn it back on. Default is true.
horizontal Default waypoints live on the vertical axis. Their offset is calculated in relation to the top of the viewport and they listen for vertical scroll changes. If horizontal is set to true, offset is calculated in relation to the left of the viewport and listens for horizontal scroll changes. For instance, the value 50 means "when the left side of this element reaches 50px from the left side of the viewport". Default is false.
offset This option determines how far the top of the element must be from the top of the viewport to trigger a waypoint (callback function). It can be a number, which is taken as a number of pixels (can be also negativ, e.g. -10), a string representing a percentage of the viewport height (e.g. '50%') or a function that will return a number of pixels. Default is 0.
continuous If true, and multiple waypoints are triggered in one scroll, this waypoint will trigger even if it is not the last waypoint reached. If false, it will only trigger if it is the last waypoint. Default is true.
triggerOnce If true, the waypoint will be destroyed when triggered. Default is false.
Events (move mouse over the names to see classes)
Name Description
reachedfired when the user scrolls past the element.
PrimeFaces Extensions Showcase - © 2011-2021,PrimeFaces: 11.0.0,PrimeFaces Extensions: 11.0.3,JSF: Apache MyFaces JSF-2.3 Core API 2.3.9,Server: jetty/9.4.36.v20210114,Build time: 2022-04-17 14:55
occured!