Changeset - ab29d4563909
[Not reviewed]
0 1 0
Brett Smith (brett) - 8 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
...
 
@@ -6,2 +6,15 @@
 

	
 
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() {
...
 
@@ -224,5 +237,2 @@ $(document).ready(function() {
 

	
 
    var supportTypeSelector = function(supportTypeHash) {
 
        return $(".supporter-type-selector a[href=" + supportTypeHash + "]");
 
    };
 
    var selectSupportTypeFromHash = function() {
...
 
@@ -230,3 +240,2 @@ $(document).ready(function() {
 
    };
 
    var $window = $(window);
 
    $window.bind("hashchange", selectSupportTypeFromHash);
...
 
@@ -235,6 +244,2 @@ $(document).ready(function() {
 
        supportTypeSelector("#annual").click();
 
    } else {
 
        $window.bind("ready", function() {
 
            scrollTop($selectorLink.offset().top);
 
        });
 
    }
0 comments (0 inline, 0 general)