Supporter page: Make supporter type selections act like tabs.
* Scroll to the type selection when the visitor follows a link to a specific type. * Don't scroll the page when the user changes their selection.
This commit is contained in:
parent
c2ee1c761d
commit
9d30d7431a
1 changed files with 14 additions and 8 deletions
|
@ -218,18 +218,24 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#form-correction-needed").removeClass("form-error-show").addClass("form-error");
|
$("#form-correction-needed").removeClass("form-error-show").addClass("form-error");
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
$(".supporter-type-selector a").bind("click", selectSupportType);
|
$(".supporter-type-selector a").bind("click", selectSupportType);
|
||||||
|
|
||||||
var selectSupportTypeFromHash = function() {
|
var supportTypeSelector = function(supportTypeHash) {
|
||||||
var urlHash = window.location.hash;
|
return $(".supporter-type-selector a[href=" + supportTypeHash + "]");
|
||||||
if ((urlHash !== "#monthly") && (urlHash !== "#renewal")) {
|
|
||||||
urlHash = "#annual";
|
|
||||||
}
|
|
||||||
$(".supporter-type-selector a[href=" + urlHash + "]").click();
|
|
||||||
};
|
};
|
||||||
$(window).bind("hashchange", selectSupportTypeFromHash);
|
var selectSupportTypeFromHash = function() {
|
||||||
selectSupportTypeFromHash();
|
return supportTypeSelector(window.location.hash).click();
|
||||||
|
};
|
||||||
|
var $window = $(window);
|
||||||
|
$window.bind("hashchange", selectSupportTypeFromHash);
|
||||||
|
var $selectorLink = selectSupportTypeFromHash();
|
||||||
|
if ($selectorLink.length === 0) {
|
||||||
|
supportTypeSelector("#annual").click();
|
||||||
|
} else {
|
||||||
|
$window.scrollTop($selectorLink.offset().top);
|
||||||
|
}
|
||||||
|
|
||||||
$( ".footnote-mark" ).tooltip({
|
$( ".footnote-mark" ).tooltip({
|
||||||
items: "a",
|
items: "a",
|
||||||
|
|
Loading…
Reference in a new issue