Merge pull request #5 from Alexia/bugfix/fix-js

Correct obvious jquery mistakes
This commit is contained in:
Alexia E. Smith 2015-04-29 12:39:04 -05:00
commit 8c0cfac7d9

View file

@ -11,10 +11,10 @@
var tabs = {}; var tabs = {};
$.fn.tabber = function() { $.fn.tabber = function() {
var nav = $('ul'); var nav = $('<ul>');
this.each(function() { this.each(function() {
var navli = $('li'), var navli = $('<li>'),
nava = $('a'), nava = $('<a>'),
title = $(this).attr('title'); title = $(this).attr('title');
nava.text(title) nava.text(title)
.attr('href', 'javascript:void(null);') .attr('href', 'javascript:void(null);')
@ -23,8 +23,8 @@
nav.append(navli); nav.append(navli);
}); });
nav.addClass('tabbernav'); nav.addClass('tabbernav');
$('tabber').append(nav); $('.tabber').append(nav);
$('tabbertab').first().show(); $('.tabbertab').first().show();
if (document.hash != '' && document.hash != '#') { if (document.hash != '' && document.hash != '#') {
var display = document.hash.replace('#', ''); var display = document.hash.replace('#', '');
$('.tabbertab[title="' + display + '"]').show(); $('.tabbertab[title="' + display + '"]').show();
@ -32,12 +32,12 @@
} else { } else {
var display = $('.tabbertab'); var display = $('.tabbertab');
display.first().show(); display.first().show();
$('tabbernav li [title="' + display.attr('title') + '"]').first().addClass('tabberactive'); $('.tabbernav li [title="' + display.attr('title') + '"]').first().addClass('tabberactive');
} }
return this; return this;
}; };
$('tabbernav li a').click(function() { $('.tabbernav li a').click(function() {
tabShow($(this).attr('title')); tabShow($(this).attr('title'));
}) })