Changeset - ab29d4563909
[Not reviewed]
0 1 0
Brett Smith (brett) - 5 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
...
 
@@ -4,6 +4,19 @@
 
**  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, ""));
...
 
@@ -222,21 +235,13 @@ $(document).ready(function() {
 
    };
 
    $(".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({
0 comments (0 inline, 0 general)