jquery change function into code for plugin

Posted by jaap Klevering on Stack Overflow See other posts from Stack Overflow or by jaap Klevering
Published on 2010-03-13T07:06:47Z Indexed on 2010/03/13 7:15 UTC
Read the original article Hit count: 252

Filed under:

Help would be greatly appreciated. What is the correct markup that would change this function into a plugin. I tried, but cant make it to work.

$(document).ready(function(){
$('ul.tabNav a').click(function() {
var curChildIndex = $(this).parent().prevAll().length + 1;
$(this).parent().parent().children('.current').removeClass('current');
$(this).parent().addClass('current');
$(this).parent().parent().next('.tabContainer').children('.current').slideUp('fast',function() {
$(this).removeClass('current');
$(this).parent().children('div:nth-child('+curChildIndex+')').slideDown('normal',function() {
$(this).addClass('current');
});
});
return true;
});
});

© Stack Overflow or respective owner

Related posts about jquery-plugins