Hi There,
I have found a very usefull and lightweight code that is made by the famous Tim Van Damme, a Dutch compatriot.
Here is the code, i will explain my question beneath.
The js that works in combination with the js libary.
<script language="javascript" type="text/javascript">
jQuery(document).ready(function($) {
$('.tabs').each(function () {
var $links = $(this).find('a'),
panelIds = $links.map(function() { return this.hash; }).get().join(","),
$panels = $(panelIds),
$panelwrapper = $panels.filter(':first').parent(),
delay = 500,
heightOffset = 10; // we could add margin-top + margin-bottom + padding-top + padding-bottom of $panelwrapper
$panels.hide();
$links.hover(function () {
var link = this,
$link = $(this);
// ignore if already visible
if ($link.is('.tabs-selected')) {
return false;
}
$links.removeClass('tabs-selected');
$link.addClass('tabs-selected');
document.title = 'jQuery look: Tim Van Damme - ' + $link.text();
if ($.support.opacity) {
$panels.stop().animate({opacity: 0 }, delay);
}
$panelwrapper.stop().animate({
height: 0
}, delay, function () {
var height = $panels.hide().filter(link.hash).css('opacity', 1).show().height() + heightOffset;
$panelwrapper.animate({
height: height
}, delay);
});
});
$links.filter(window.location.hash ? '[hash=' + window.location.hash + ']' : ':first').click();
});
});
</script>
The corresponding HTML code
<ul class="tabs tabs-nav">
<li><a href="#news"><span>News</span></a></li>
<li><a href="#blog"><span>Blog</span></a></li>
</ul>
<div class="panels">
<div id="news" class="panel">
<h1> hello news panel</h2>
</div>
<div id="blog" class="panel">
<h1> hello blog panel</h2>
</div>
</div>
This all works fine and I just want 1 small modification which i can't get done.
I want this list item
<li><a href="#news"><span>News</span></a></li>
like this so i can use the href to actually link to a page
<li><a href="http:www.mysite.nl/news" rel="#news"><span>News</span></a></li>
I am not that familiar with js but i tryed multiple things and searched a while on the internet but can't get the job done.
I thought this would be simple to change, well, not for me right. Can one of you point me in the right direction?