I did try Firebug but everything checked out. I also pulled all other scripts
off the page aside from that specific code and it still wasn't working. So I
then decided to rebuild that section of code, and as long as the return
false; was in there, it started working.

The only thing I can figure is that maybe one of the characters were bad and
was causing a problem. Regardless, it works well now.

Thanks for all your help.


Karl Swedberg-2 wrote:
> 
> I wonder if the problem might be elsewhere in your code.
> 
> I put your code snippet into my page, added  # ...  and a couple <div
> class="items">...</div>,  
> and tried it out. It's working just fine on Firefox 2 for Mac.
> 
> http://test.learningjquery.com/slidedown.htm
> 
> Have you tried isolating the problem using Firebug? (www.getfirebug.com)
> Have you commented out all other code and reintroduced it bit by bit?
> 
> 
> --Karl
> _________________
> Karl Swedberg
> www.englishrules.com
> www.learningjquery.com
> 
> 
> 
> On Dec 31, 2006, at 5:05 PM, smoore wrote:
> 
>>
>> Karl, I tested yours successfully, so I'm not sure why I'm getting  
>> the jump
>> back to top. I'm handling the show/hide with the following:
>>
>> $("a.show_all").click(function(){
>>     var all_items = $("div.items");
>>     var all_link = $("a.show_all");
>>     if ( all_items.is(":hidden") ) {
>>          all_items.slideDown("normal");
>>        all_link.html("text goes here");
>>        return false;}
>>     else {
>>      all_items.slideUp("normal");
>>      all_link.html("text goes here");
>>      return false;}
>> });
>>
>> I'll try to find the time to put together an almost-identical demo  
>> of what
>> I'm doing as I can't provide the exact page due to confidentiality  
>> issues.
>>
>>
>>
>> Karl Swedberg-2 wrote:
>>>
>>> I set up a little test case but couldn't replicate your problem. See:
>>> http://test.learningjquery.com/slidedown.htm
>>>
>>> Let me know if my page works for you, as well. If it does work,
>>> perhaps you could provide a link to the page that is causing the
>>> problem. Then we'll have a better shot at identifying the source of
>>> the problem
>>>
>>>
>>> --Karl
>>> _________________
>>> Karl Swedberg
>>> www.englishrules.com
>>> www.learningjquery.com
>>>
>>>
>>>
>>> On Dec 31, 2006, at 9:13 AM, smoore wrote:
>>>
>>>>
>>>> Hi Karl, I was using return false; but still had no luck. I'm
>>>> wondering if
>>>> you can't stop the page from jumping back to the top since the
>>>> browser's
>>>> scrollbars expand/contract when you slide the content down/up.
>>>>
>>>> It would seem odd if that was the case, but it also seems a bit odd
>>>> that I
>>>> couldn't find any discussions on this issue. I did a couple
>>>> searches on this
>>>> forum and also on Google, but didn't really find any relevant  
>>>> results.
>>>>
>>>> You can set the href to #something and then add a name="something"
>>>> at the
>>>> point of the link which sort of works. You don't jump back to the
>>>> top, but
>>>> the section with    will jump to the top.
>>>>
>>>> It's not the desired effect though and it'd seem like you should be
>>>> able to
>>>> handle it with JavaScript.
>>>>
>>>>
>>>>
>>>> Karl Swedberg-2 wrote:
>>>>>
>>>>> Hi Scott,
>>>>>
>>>>> It looks like you just need to add a return false; after
>>>>> the .slideDown() and .slideUp()
>>>>>
>>>>> For example:
>>>>> $('a.shownext').click(function() {
>>>>>    $(this).next().slideDown('slow');
>>>>>    return false;
>>>>> });
>>>>>
>>>>> In other words, you need to prevent the default action from
>>>>> occurring.
>>>>>
>>>>> --Karl
>>>>> _________________
>>>>> Karl Swedberg
>>>>> www.englishrules.com
>>>>> www.learningjquery.com
>>>>>
>>>>>
>>>>>
>>>>> On Dec 30, 2006, at 9:29 PM, smoore wrote:
>>>>>
>>>>>>
>>>>>> I don't think I provided enough explanation. I have a page that  
>>>>>> has
>>>>>> a link
>>>>>> about half way down. When you scroll the page down to bring the
>>>>>> link closer
>>>>>> to the top, and then click the link, the page jumps back to the  
>>>>>> top
>>>>>> and then
>>>>>> the content slides open. The same happens when hiding the content.
>>>>>>
>>>>>> On the href, I've tried using # and javascript:void(0), but the
>>>>>> page still
>>>>>> jumps back to the top.
>>>>>>
>>>>>>
>>>>>> Matt Stith wrote:
>>>>>>>
>>>>>>> The only way i can think would be to make some kind of  
>>>>>>> transparent
>>>>>>> object
>>>>>>> that is down near the bottom of the object being slid up, but the
>>>>>>> reason
>>>>>>> it
>>>>>>> scrolls up is because theres nothing else down there.
>>>>>>>
>>>>>>> On 12/30/06, smoore <[EMAIL PROTECTED]> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> What's the best way to prevent a page from scrolling back to the
>>>>>>>> top when
>>>>>>>> using slideUp/slideDown near the bottom of the page?
>>>>>>>> --
>>>>
> 
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Stop-page-scroll-when-using-slideUp-slideDown-tf2900175.html#a8124449
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to