dimanche 3 janvier 2016

Where I can find a template for randomising pictures and quotes without correspondence?

I found templates for generating random quotes and templates for for generating random pictures.

I'm looking for a template generates a random quote and a random picture much like this one but there is no correspondence between the quote and the picture.

Anyone know any? How about where I might find such? Keywords?

Or: how can I adjust the code below to achieve such?


HTML

<html lang="en">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  <title>Random Quote Machine</title>

  <!-- Bootstrap -->
  <link href="css/bootstrap.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

  <link href='http://ift.tt/1r5wBQo' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="http://ift.tt/1PinXyn">

  <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
      <script src="http://ift.tt/1xwklwE"></script>
      <script src="http://ift.tt/1qIredN"></script>
    <![endif]-->
</head>

<body>
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="col-md-4 text-center">
        <h1>V for Vendetta</h1>

        <div class="quoteBox">
          <p class="quote">Behind this mask there is more than just flesh. Beneath this mask there is an idea... and ideas are bulletproof. </p>
          <span class="hero">- Alan Moore, V for Vendetta</span>
        </div>

        <div class="buttons">
          <a class="btn btn-danger quoteButton" id="quoteBtn"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></a>

          <a class="btn btn-primary tweetButton" id="tweetBtn" href="https://twitter.com/intent/tweet?text=" target="_blank"><i class="fa fa-twitter"></i></a>
        </div>
      </div>

      <div class="col-md-8 text-center">
        <img class="img-responsive" src="http://ift.tt/1R5rkt4">
      </div>
    </div>
  </div>


  <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  <script src="http://ift.tt/1LdO4RA"></script>
  <!-- Include all compiled plugins (below), or include individual files as needed -->
  <!-- Latest compiled and minified JavaScript -->
  <script src="http://ift.tt/1jAc4pg"></script>

</body>

</html>

CSS

body {
  background-color: black;
  color: white;
  font-family: Raleway;
}

.container {
  margin: 0 50px;
}

h1 {
  font-size: 60px;
  padding: 150px 0 5px 0;
}

.quoteButton,
.tweetButton {
  padding: 5px 25px 5px 25px;
}

#quoteBtn {
  margin-right: 5px;
}

.quoteBox {
  padding: 25px 0 30px 0;
}

.quote {
  font-size: 20px;
}

span {
  font-style: italic;
}

img {
  padding: 50px 0 0 0;
}

JS

  $(document).ready(function() {
    $('#quoteBtn').on('click', function() {
      var quotes = [{
        'author': '- Alan Moore, V for Vendetta',
        'quote': "People shouldn't be afraid of their government. Governments should be afraid of their people.",
        'img': 'http://ift.tt/1VzfZk6'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "Everybody is special. Everybody. Everybody is a hero, a lover, a fool, a villain. Everybody. Everybody has their story to tell.",
        'img': 'http://ift.tt/1VzfZka'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "Remember, remember the fifth of November of gunpowder treason and plot. I know of no reason why the gun powder treason should ever be forgot.",
        'img': 'http://ift.tt/1ZIv5Gi'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "Love your rage, not your cage.",
        'img': 'http://ift.tt/1ZIv6tP'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "It seems strange that my life should end in such a terrible place, but for three years I had roses, and apologized to no one.",
        'img': 'http://ift.tt/1PFWxSh'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "There's no flesh or blood within this cloak to kill. There's only an idea. Ideas are bulletproof.",
        'img': 'http://ift.tt/1ZIv5Go'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "Knowledge, like air, is vital to life. Like air, no one should be denied it.",
        'img': 'http://ift.tt/1ZIv6tT'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "Happiness is the most insidious prison of all.",
        'img': 'http://ift.tt/1R5rktb'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "I shall die here. Every last inch of me shall perish. Except one. An inch. It's small and it's fragile and it's the only thing in the world worth having. we must never lose it, or sell it, or give it away. We must never let them take it from us.",
        'img': 'http://ift.tt/1R5rmkG'
      }, {
        'author': '- Alan Moore, V for Vendetta',
        'quote': "The past can't hurt you anymore, not unless you let it.",
        'img': 'http://ift.tt/1VzfZAs'
      }];

      var randomQuote = Math.floor((Math.random() * quotes.length));

      $('.quote').html(quotes[randomQuote]['quote']);
      $('.hero').html(quotes[randomQuote]['author']);
      $('.img-responsive').attr('src', quotes[randomQuote]['img']);

      $("#tweetBtn").on('click', function() {
        $("#tweetBtn").attr('href', "https://twitter.com/intent/tweet?text=" + quotes[randomQuote]['quote'] + quotes[randomQuote]['author']);
      });
    })
  });




Aucun commentaire:

Enregistrer un commentaire