Pergunta

I am using Primefaces 3.5 and I need to use the sticky tag. I got the code from the showcase. So here is my code:

<p:toolbar id="myToolbar">  
    <p:toolbarGroup align="left">  
        <p:commandButton type="button" value="Some Button" />  
    </p:toolbarGroup>
</p:toolbar>
<p:sticky target="myToolbar" />

I get the error:

/index.xhtml @26,36 Tag Library supports namespace: http://primefaces.org/ui, but no tag was defined for name: sticky

If I remove the sticky part everything works fine. What could this error be?

Foi útil?

Solução

I'm afraid it's not supported in 3.5. Try using Primefaces 4.0 - User Guides. Use css

.myComponent(
    position: fixed;
)

and some jQuery to simulate similar behaviour. Here's some JS code snippet that I wrote a while ago to do just that.

$(document).on("scroll", function(){
   if($(document).scrollTop() >= 180){
       $('.header').css({'position': 'fixed'});
       $('#mainBody').css('margin-top', '182px');
   } else {
       $('.header').css({'position': 'relative'});
       $('#mainBody').css('margin-top', '110px');
   }
}    
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top