[jQuery] Newbie question about toggle.

2009-05-21 Thread Lacrima

Hello!

I think very simple question, but I am very new to jquery...
For example, I have the next code:

$('#info').hide();
$('a#show_hide_info').click(function(){
$('#info').toggle();
});

So when a user click on #show_hide_info, #info element become visible
or invisible.
But the #show_hide_info element is placed on the top of the page and
the #info element is on the bottom of the page. The bottom of the page
isn't visible to the user because the page is too long.
So when user clicks #show_hide_info he doesn't see any effect because
#info element is several screens down.
How should I scroll down the page to the #info element when user
clicks #show_hide_info???

Sorry if my English is not very good.
Thank you in advance.

With regards,
Max.


[jQuery] Re: Newbie question about toggle.

2009-05-21 Thread Lacrima

Hi Ryan,
Thanks for reply!

I tried to use anchor, but it doesn't work:

$('#info').hide();
$('a#show_hide_info').click(function(){
$('#info').toggle();
});

a id=show_hide_info href=#fooShow/hide info/a
!-- a lot of html tags here --
div id = infoa name = 'foo' href=#some/a/div

When I click #show_hide_info, this doesn't move me to my anchor.
So what I am doing wrong?

With regards,
Max.


On May 21, 5:11 pm, ryan.j ryan.joyce...@googlemail.com wrote:
 sounds like you could jsut use an inline anchor, with the JS being
 executed in the onclick event

 On May 21, 8:11 am, Lacrima lacrima.ma...@gmail.com wrote:

  Hello!

  I think very simple question, but I am very new to jquery...
  For example, I have the next code:

          $('#info').hide();
          $('a#show_hide_info').click(function(){
              $('#info').toggle();
          });

  So when a user click on #show_hide_info, #info element become visible
  or invisible.
  But the #show_hide_info element is placed on the top of the page and
  the #info element is on the bottom of the page. The bottom of the page
  isn't visible to the user because the page is too long.
  So when user clicks #show_hide_info he doesn't see any effect because
  #info element is several screens down.
  How should I scroll down the page to the #info element when user
  clicks #show_hide_info???

  Sorry if my English is not very good.
  Thank you in advance.

  With regards,
  Max.