Skip to content

Instantly share code, notes, and snippets.

@mrosati84
Last active May 24, 2019 15:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mrosati84/4110115 to your computer and use it in GitHub Desktop.
Save mrosati84/4110115 to your computer and use it in GitHub Desktop.
Demo responsive iframe slider
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
<style type="text/css">
#slider {
width: 100%;
}
#debug {
margin: 15px;
}
</style>
</head>
<body>
<div id="slider"></div>
<div id="debug">Debug info</div>
<iframe id="iframe" style="margin-top: 50px;" src="http://foundation.zurb.com/page-templates/feed.html" frameborder="0" width="100%" height="600"></iframe>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/furf/jquery-ui-touch-punch/master/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript">
(function () {
var iframe = $('#iframe'),
debug = $('#debug'),
updateDebug = function () {
debug.html(iframe.width() + 'px');
};
$('#slider').slider({
min: 0,
max: 100,
slide: function (event, ui) {
iframe.width((100 - ui.value) + '%');
updateDebug();
}
});
$(window).on('resize', function () {
debug.html(iframe.width());
updateDebug();
});
}());
</script>
</body>
</html>
@murdoch
Copy link

murdoch commented Aug 16, 2013

What is the slider supposed to do?

@NKjoep
Copy link

NKjoep commented Jul 13, 2018

This is the example: https://jsfiddle.net/yr5qLw4f/3/

A slider in a webpage which controls the iframe width.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment