Last active
May 24, 2019 15:51
-
-
Save mrosati84/4110115 to your computer and use it in GitHub Desktop.
Demo responsive iframe slider
This file contains hidden or 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
<!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> |
This is the example: https://jsfiddle.net/yr5qLw4f/3/
A slider in a webpage which controls the iframe width.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the slider supposed to do?