Created
July 16, 2014 14:34
-
-
Save willwright82/34fa71100bf8b1aebea5 to your computer and use it in GitHub Desktop.
Trust Pilot iFrame Dynamic Width
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
<style type="text/css"> | |
div.trust-pilot{ | |
width: 100% !important; | |
height: auto; | |
} | |
</style> | |
<div id="trust-pilot" class="trust-pilot"> | |
<div class="tp_-_box" data-tp-settings="domainId: xxxxxxx, | |
bgColor: F5F5F5, | |
showRatingText: False, | |
showComplementaryText: False, | |
showUserImage: False, | |
showDate: False, | |
width: -1, | |
numOfReviews: 6, | |
useDynamicHeight: False, | |
height: 348 "> | |
</div> | |
<script type="text/javascript"> | |
(function () { | |
var a = "https:" == document.location.protocol ? "https://ssl.trustpilot.com" : "http://s.trustpilot.com", b = document.createElement("script"); | |
b.type = "text/javascript"; | |
b.async = true; | |
b.src = a + "/tpelements/tp_elements_all.js"; | |
var c = document.getElementsByTagName("script")[0]; | |
c.parentNode.insertBefore(b, c) })(); | |
</script> | |
</div> | |
<script type="text/javascript"> | |
jQuery( window ).load(function() { | |
_width = jQuery('#trust-pilot').innerWidth(); | |
jQuery('#tpiframe-box0').attr('width',_width); | |
}); | |
</script> | |
<script type="text/javascript"> | |
jQuery( window ).resize(function() { | |
_width = jQuery('#trust-pilot').innerWidth(); | |
jQuery('#tpiframe-box0').attr('width',_width); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment