Last active
December 30, 2015 22:18
-
-
Save FCO/7892840 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<!-- | |
Created using jsbin.com | |
Source can be edited via http://jsbin.com/OtIfiFEw/1/edit | |
--> | |
<head> | |
<script src="http://code.jquery.com/jquery.min.js"></script> | |
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"> | |
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" /> | |
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script> | |
<meta charset=utf-8 /> | |
<title>Biveers</title> | |
<style id="jsbin-css"> | |
</style> | |
</head> | |
<body> | |
<header> | |
<h1> | |
Rio de Janeiro <br> | |
Perl Mongers | |
</h1> | |
<h2> | |
CPAN é a linguagem. Perl é apenas a sintaxe. | |
</h2> | |
<a href="http://rio.perl.org.br/"> | |
<img alt="Rio de Janeiro Perl Mongers" src="http://rio.perl.org.br/images/bg1.png" id="frontphoto" width="760" height="175"> | |
</a> | |
</header> | |
<script> | |
function Subtitle(obj, subtitles) { | |
if(obj != null) this.obj = obj; | |
else this.obj = $(document.body); | |
if(subtitles != null) this.subtitles = subtitles; | |
else | |
this.subtitles = [ | |
"CPAN é a linguagem. Perl é apenas a sintaxe", | |
"Existe mais de uma maneira de fazer isso", | |
"Manter coisas simples de forma simples e tornar coisas difíceis possíveis", | |
"use Perl", | |
]; | |
this.refresh(); | |
} | |
Subtitle.prototype = { | |
getSubtitle: function() { | |
var index = Math.floor((Math.random() * this.subtitles.length)+0); | |
return this.subtitles[index]; | |
}, | |
refresh: function() { | |
var _sub = this; | |
this.obj.fadeOut(function(){ | |
$(this).text(_sub.getSubtitle()); | |
$(this).fadeIn(); | |
}); | |
} | |
}; | |
$(function(){ | |
var subtitle = new Subtitle($('header > h2')) | |
setInterval(function(){ | |
subtitle.refresh(); | |
}, 5000); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment