Created
October 28, 2019 09:13
-
-
Save ambercouch/171adde179d8d2f6587f81c86e2ead6c to your computer and use it in GitHub Desktop.
BBD Geo ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('a[href^="#"]').on('click',function (e) { | |
e.preventDefault(); | |
var target = this.hash; | |
var $target = $(target); | |
$('html, body').stop().animate({ | |
'scrollTop': $target.offset().top | |
}, 900, 'swing', function () { | |
window.location.hash = target; | |
}); | |
}); | |
}); | |
jQuery.ajax( { | |
url: '//freegeoip.net/json/', | |
type: 'POST', | |
dataType: 'jsonp', | |
success: function(location) { | |
// If the visitor is browsing from Canada. | |
if (location.country_code === 'CA') { | |
// Redirect him to the Canadian store. | |
window.top.location.href = 'https://bibado.ca/'; | |
} | |
} | |
} ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment