Skip to content

Instantly share code, notes, and snippets.

@jondkinney
Created February 15, 2013 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jondkinney/4964288 to your computer and use it in GitHub Desktop.
Save jondkinney/4964288 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
var attorneys_html, hideRoles, investors_html, page, path, revealRoles, small_business_html, url;
$('.role_choices').hide();
revealRoles = function(element) {
$('.role_choices').slideDown('fast');
$(element).addClass('button_text_and_arrow_open');
$(element).removeClass('button_text_and_arrow_closed');
return $('.down_arrow').css('background-position', '0px -23px');
};
hideRoles = function(element) {
$('.role_choices').slideUp('fast');
$(element).addClass('button_text_and_arrow_closed');
$(element).removeClass('button_text_and_arrow_open');
return $('.down_arrow').css('background-position', '0px 0px');
};
$(document).delegate(".button_text_and_arrow_closed", 'click', function(e) {
return revealRoles('.button_text_and_arrow_closed');
});
$(document).delegate(".button_text_and_arrow_open", 'click', function(e) {
return hideRoles('.button_text_and_arrow_open');
});
$(document).delegate(".button_text_and_arrow_closed", 'mouseenter', function(e) {
return revealRoles('.button_text_and_arrow_closed');
});
$('.required input:text, .required input[type="email"]').each(function(index, element) {
return $(this).keyup(function() {
var value;
value = $(this).val();
return $("." + ($(this).attr('name'))).val(value);
});
});
url = $.url();
path = url.attr('path');
if (path === "/small-business" || path === "/investors" || path === "/attorneys") {
$('#home_role_Entrepreneur').attr('checked', true);
}
if (path === "/") {
page = 'home';
} else if (path === "/small-business") {
page = 'small_business';
} else if (path === '/investors') {
page = 'investors';
} else if (path === '/attorneys') {
page = 'attorneys';
}
small_business_html = $('.button_text_small_business').html();
investors_html = $('.button_text_investors').html();
attorneys_html = $('.button_text_attorneys').html();
$("#" + page + "_role_Entrepreneur").click(function() {
return $(".button_text_" + page).html(small_business_html);
});
$("#" + page + "_role_Investor").click(function() {
return $(".button_text_" + page).html(investors_html);
});
return $("#" + page + "_role_Attorney").click(function() {
return $(".button_text_" + page).html(attorneys_html);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment