You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by smallufo <sm...@gmail.com> on 2015/05/20 17:19:02 UTC

Re: ClientProperties.getBrowserWidth() always returns -1

It seems the ClientProperties is cached in session.
Even if I resize the window , it will show the first result.

Is it possible to get the latest browser width/height ?
Thanks.

2015-04-18 20:23 GMT+08:00 Martin Grigorov <mg...@apache.org>:

> Hi,
>
> Check wicket-examples. There are demos of (Ajax)BrowserInfo
> On Apr 17, 2015 10:56 PM, "smallufo" <sm...@gmail.com> wrote:
>
> > 2015-04-18 9:53 GMT+08:00 smallufo <sm...@gmail.com>:
> >
> > > getApplicationSettings().setUploadProgressUpdatesEnabled(true);
> > >
> >
> > typo
> > It is
> > *getRequestCycleSettings().setGatherExtendedBrowserInfo(true);*
> >
> > width is still -1
> >
>

Re: ClientProperties.getBrowserWidth() always returns -1

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Thu, May 21, 2015 at 4:40 AM, smallufo <sm...@gmail.com> wrote:

> 2015-05-20 23:27 GMT+08:00 Martin Grigorov <mg...@apache.org>:
>
> > You can use AjaxBrowserInfoBehavior.
> >
>
>
> I think you mean AjaxClientInfoBehavior
> http://www.wicket-library.com/wicket-examples-6.0.x/ajaxhellobrowser/?0
>
> Thanks . it's working well !
>
> But I have another question.
>

Please use a new thread for new questions.


>
> Is there any way to get the containing element's width ?
>
> for example :
>
>
> *<div class="col-xs-12 col-sm-4">  <img wicket:id="img"/></div>*
>
> It will have different proportion in different width
> for XS (extreme small) screen , it will be 100% width
> and for SM (small) or larger  screen , it will cover 1/3 width
> Is it possible to dynamically get the width of the containing element ?
> (so that I can generate correct width image )
>

This is rather a JS/CSS question, not Wicket/Java.
It is possible. You should use the computed style of the container element.
Once you read the width/height you can use Wicket Ajax to send the data to
the server.



>
> Thanks.
>

Re: ClientProperties.getBrowserWidth() always returns -1

Posted by smallufo <sm...@gmail.com>.
2015-05-20 23:27 GMT+08:00 Martin Grigorov <mg...@apache.org>:

> You can use AjaxBrowserInfoBehavior.
>


I think you mean AjaxClientInfoBehavior
http://www.wicket-library.com/wicket-examples-6.0.x/ajaxhellobrowser/?0

Thanks . it's working well !

But I have another question.

Is there any way to get the containing element's width ?

for example :


*<div class="col-xs-12 col-sm-4">  <img wicket:id="img"/></div>*

It will have different proportion in different width
for XS (extreme small) screen , it will be 100% width
and for SM (small) or larger  screen , it will cover 1/3 width
Is it possible to dynamically get the width of the containing element ?
(so that I can generate correct width image )

Thanks.

Re: ClientProperties.getBrowserWidth() always returns -1

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can use AjaxBrowserInfoBehavior.
On May 20, 2015 6:19 PM, "smallufo" <sm...@gmail.com> wrote:

> It seems the ClientProperties is cached in session.
> Even if I resize the window , it will show the first result.
>
> Is it possible to get the latest browser width/height ?
> Thanks.
>
> 2015-04-18 20:23 GMT+08:00 Martin Grigorov <mg...@apache.org>:
>
> > Hi,
> >
> > Check wicket-examples. There are demos of (Ajax)BrowserInfo
> > On Apr 17, 2015 10:56 PM, "smallufo" <sm...@gmail.com> wrote:
> >
> > > 2015-04-18 9:53 GMT+08:00 smallufo <sm...@gmail.com>:
> > >
> > > > getApplicationSettings().setUploadProgressUpdatesEnabled(true);
> > > >
> > >
> > > typo
> > > It is
> > > *getRequestCycleSettings().setGatherExtendedBrowserInfo(true);*
> > >
> > > width is still -1
> > >
> >
>