Last active
December 14, 2016 07:00
-
-
Save sprankhub/ff14363aa3a7103a92d5 to your computer and use it in GitHub Desktop.
Responsive Trusted Shops Trustbadge
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
// make sure that $j is your jQuery function or customise accordingly | |
// make sure that "trustbadge" is the ID of your custom trusted shops container or customise accordingly | |
$j(window).on("load resize", function(e) { | |
// responsive Trusted Shops badge | |
var trustbadgeContainerWidth = $j('#trustbadge').width(); | |
// trusted shops ignores the customBadgeWidth, so set the height accordingly | |
_tsConfig.customBadgeHeight = (90/264) * trustbadgeContainerWidth; | |
// on a normal load event, the badge is loaded afterwards anyway | |
if (e.type == 'resize' && typeof trustbadge == 'object' && typeof trustbadge.reInitialize == 'function') { | |
$j('#trustbadge').html(''); | |
$j("[id^='tsbadge']").remove(); | |
$j("[id^='tscard']").remove(); | |
trustbadge.reInitialize(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment