Skip to content

Instantly share code, notes, and snippets.

@dearaujoj
Forked from anonymous/gist:2388015
Created May 11, 2012 23:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dearaujoj/2663082 to your computer and use it in GitHub Desktop.
Save dearaujoj/2663082 to your computer and use it in GitHub Desktop.
iOS fix for iframe cropping
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
if (/iPhone|iPod|iPad/.test(navigator.userAgent))
$('iframe').wrap(function(){
var $this = $(this);
return $('<div />').css({
width: $this.attr('width'),
height: $this.attr('height'),
overflow: 'auto',
'-webkit-overflow-scrolling': 'touch'
});
});
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment