Changeset - ab29d4563909
[Not reviewed]
0 1 0
Brett Smith (brett) - 6 years ago 2016-09-09 19:16:46
brett@sfconservancy.org
Supporter page: Try #2 for scroll to type selection after window ready.

* Trigger on the "load" event rather than "ready".
* Install the handler outside document's "ready" handler so it should
take effect more reliably.
1 file changed with 13 insertions and 8 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/js/supporter-page.js
Show inline comments
 
/* Copyright (C) 2012-2013 Denver Gingerich, 
 
** Copyright (C) 2013-2014 Bradley M. Kuhn.
 
** License: GPLv3-or-later
 
**  Find a copy of GPL at https://sfconservancy.org/GPLv3
 
*/
 

	
 
var supportTypeSelector = function(supportTypeHash) {
 
    return $(".supporter-type-selector a[href=" + supportTypeHash + "]");
 
};
 

	
 
var $window = $(window);
 

	
 
$window.load(function() {
 
    var $selectorLink = supportTypeSelector(window.location.hash);
 
    if ($selectorLink.length > 0) {
 
        $window.scrollTop($selectorLink.offset().top);
 
    }
 
});
 

	
 
$(document).ready(function() {
 
    var siteFinalGoal = $('span#site-fundraiser-final-goal').text();
 
    var noCommaSiteFinalGoal = parseInt(siteFinalGoal.replace(/,/g, ""));
 
    var siteMiddleGoal = $('span#site-fundraiser-middle-goal').text();
 
    var noCommaSiteMiddleGoal = parseInt(siteMiddleGoal.replace(/,/g, ""));
 
    var siteSoFar = $('span#site-fundraiser-so-far').text();
...
 
@@ -219,27 +232,19 @@ $(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() {
 
        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.bind("ready", function() {
 
            scrollTop($selectorLink.offset().top);
 
        });
 
    }
 

	
 
    $( ".footnote-mark" ).tooltip({
 
        items: "a",
 
        hide: { duration: 5000 },
 
        position: {
0 comments (0 inline, 0 general)