Bones/js/app.js

62 lines
1.5 KiB
JavaScript
Raw Normal View History

$(document).ready(function() {
/* Use this js doc for all application specific JS */
/* TABS --------------------------------- */
/* Remove if you don't need :) */
var tabs = $('dl.tabs');
tabsContent = $('ul.tabs-content')
tabs.each(function(i) {
//Get all tabs
var tab = $(this).children('dd').children('a');
tab.click(function(e) {
//Get Location of tab's content
var contentLocation = $(this).attr("href")
contentLocation = contentLocation + "Tab";
//Let go if not a hashed one
if(contentLocation.charAt(0)=="#") {
e.preventDefault();
//Make Tab Active
tab.removeClass('active');
$(this).addClass('active');
//Show Tab Content
$(contentLocation).parent('.tabs-content').children('li').css({"display":"none"});
$(contentLocation).css({"display":"block"});
}
});
});
/* PLACEHOLDER FOR FORMS ------------- */
/* Remove if you don't need :) */
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.addClass('placeholder');
input.val(input.attr('placeholder'));
}
}).blur();
$('[placeholder]').parents('form').submit(function() {
$(this).find('[placeholder]').each(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
});
});
});