Changeset - 9d30d7431a1e
[Not reviewed]
0 1 0
Brett Smith (brett) - 5 years ago 2016-09-09 18:35:15
brett@sfconservancy.org
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.
1 file changed with 13 insertions and 7 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/js/supporter-page.js
Show inline comments
...
 
@@ -218,18 +218,24 @@ $(document).ready(function() {
 
            }
 
        });
 
        $("#form-correction-needed").removeClass("form-error-show").addClass("form-error");
 
        return false;
 
    };
 
    $(".supporter-type-selector a").bind("click", selectSupportType);
 

	
 
    var supportTypeSelector = function(supportTypeHash) {
 
        return $(".supporter-type-selector a[href=" + supportTypeHash + "]");
 
    };
 
    var selectSupportTypeFromHash = function() {
 
        var urlHash = window.location.hash;
 
        if ((urlHash !== "#monthly") && (urlHash !== "#renewal")) {
 
            urlHash = "#annual";
 
        }
 
        $(".supporter-type-selector a[href=" + urlHash + "]").click();
 
        return supportTypeSelector(window.location.hash).click();
 
    };
 
    $(window).bind("hashchange", selectSupportTypeFromHash);
 
    selectSupportTypeFromHash();
 
    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({
 
        items: "a",
0 comments (0 inline, 0 general)