Last active
December 20, 2015 05:29
-
-
Save VadimKirilchuk/6078408 to your computer and use it in GitHub Desktop.
Useful snippet for creating utility view which rotates through different locations by using twitter bootstrap carousel.
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Super view rotation</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="author" content="Vadim Kirilchuk"> | |
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> | |
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> | |
<style> | |
html, body, .carousel, .item, .active, .carousel-inner, .container-fluid { height:100%; } | |
.container-fluid { padding: 0px;} | |
iframe, img { height:100%; width:100%; overflow:hidden;} | |
iframe::-webkit-scrollbar { display: none; } | |
h4 { font-size: 100px; } | |
</style> | |
</head> | |
<body> | |
<div class="container-fluid"> | |
<div id="myCarousel" class="carousel slide"> | |
<ol class="carousel-indicators"> | |
<li data-target="#myCarousel" data-slide-to="0" class="active"></li> | |
<li data-target="#myCarousel" data-slide-to="1"></li> | |
<li data-target="#myCarousel" data-slide-to="2"></li> | |
</ol> | |
<!-- Carousel items --> | |
<div class="carousel-inner"> | |
<div class="active item"> | |
<iframe src="https://builds.apache.org/"></iframe> | |
<div class="carousel-caption"> | |
<h4>Apache jenkins</h4> | |
</div> | |
</div> | |
<div class="item"> | |
<img src="http://assets.diylol.com/hfs/571/d11/750/resized/gollum-meme-generator-boobs-we-like-boobs-6b4111.jpg?1364277943.jpg"></img> | |
<div class="carousel-caption"> | |
<h4>Gollum</h4> | |
</div> | |
</div> | |
<div class="item"> | |
<img src="http://thechive.files.wordpress.com/2012/06/epic-boob-gif-thread-bodybuilding-com-forums-eb0a5a45-sz500x450-animate.gif"></img> | |
<div class="carousel-caption"> | |
<h4>Tits</h4> | |
</div> | |
</div> | |
</div> | |
<!-- Carousel nav | |
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a> | |
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a> | |
--> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$('.carousel').carousel({ | |
interval: 15000, | |
pause: false, | |
cycle: true | |
}); | |
window.setInterval(refresh, 60000); | |
function refresh() { | |
$('iframe').each(function() { | |
// setting iframe src = src is a hack to reload iframe | |
$(this).attr( 'src', function ( i, val ) { return val; }); | |
}); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment