Your 2 toggles are simply swapping 'right' and 'down' classes around,
otherwise they are the same. So you could just use a click handler,
and toggleClass on 'right' and 'down'.
Eg.

$('.container').click(function(){
    $(this).toggleClass('right').toggleClass('down');
    // check height of window and if too tall - show bottom nav
    $('#bottomnav')[$('#wrapper').height() > 400 ? 'show' : 'hide']();
  });

On Dec 7, 6:21 pm, "Priest, James (NIH/NIEHS) [C]"
<[EMAIL PROTECTED]> wrote:
> I've got some toggle code where I want to check the height of something
> using the dimensions plugin and am not sure the best way to do this:
>
>                 $('.container').toggle(
>                         function() {
>
> $(this).removeClass('right').addClass('down');
>
>                                 // check height of window and if too
> tall - show bottom nav
>                                 if ($('#wrapper').height() > 400) {
>                                         $('#bottomnav').show();
>                                 } else {
>                                         $('#bottomnav').hide();
>                                 };
>                         },
>                         function() {
>
> $(this).removeClass('down').addClass('right');
>
>                                 // check height of window and if too
> tall - show bottom nav
>                                 if ($('#wrapper').height() > 400) {
>                                         $('#bottomnav').show();
>                                 } else {
>                                         $('#bottomnav').hide();
>                                 };
>                         });
>
> Seems like I should be able to simplify the height check instead of
> doing everything twice???
>
> Thanks,
> Jim

Reply via email to