Sunday, August 2, 2009

[jQuery] Re: Tabs: page jumps to top when tab changes

Thanks. I don't know javascript much. Where would i put the return
false

I have:
<script type="text/javascript">
$(function() {
$("#tabs").tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000);
});
</script>

And i am not using onclick events. I tried using:

<script type="text/javascript">
$(document).ready(function(){
$('#tabs div').hide();
$('#tabs div:first').show();
$('#tabs ul li:first').addClass('active');

$('#tabs ul li a').click(function(){
$('#tabs ul li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
$('#tabs div').hide();
$(currentTab).show();
return false;
});
});

</script>

and that works but i lose the fade effect and am not sure where to put
it back in.

On Jul 30, 7:33 pm, kalyan Chatterjee <kalyan11021...@gmail.com>
wrote:
> Just try to write    return false on tab click event.
>
> On Jul 29, 6:53 pm, chris_huh <chris....@gmail.com> wrote:
>
> > Thanks but I can't find jquery.history_remote.pack.js. I am using
> > jquery 1.7.1 and the tabs thing that comes with JQuery UI.
>
> > On Jul 29, 2:25 pm, rupak mandal <rupakn...@gmail.com> wrote:
>
> > > Hi, if you remove the "jquery.history_remote.pack.js" then I think it works
> > > properly.
>
> > > On Wed, Jul 29, 2009 at 5:50 PM, chris_huh <chris....@gmail.com> wrote:
>
> > > > At the moment my page will jump to the top (because of the #) whenever
> > > > a new tab is clicked or when it automatically rotates to one.
>
> > > > Is there a way to stop this, maybe using an onclick event instead of
> > > > relying on the #tabs links?

No comments: