Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="header">
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <h1 class="cover-heading">Random Quote Machine</h1>
        <div class="panel panel-default col-md-8 col-md-offset-2" id="app">
          <div class="panel-body">
            <component :is="view" transition="fade" :data-quote1="quote1" :data-quote2="quote2" transition-mode="out-in"></component>
          </div>
          <div class="panel-footer social">
            <ul>
              <li><a href="#" @click="newQuote" title="Click for new quote"><i class="fa fa-refresh" id="rotateRefresh"></i></a></li>
              <li><a href="https://twitter.com/intent/tweet?text={{ urlQuote }}" target="_blank" title="Tweet this quote!"><i class="fa fa-twitter"></i></a></li>
              <li><a href="whatsapp://send?text={{ urlQuote }}" title="Share via Whatsapp"><i class="fa fa-whatsapp"></i></a></li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body,
html {
  width: 100%;
  height: 100%;
  font-family: "Source Sans Pro", sans-serif;
}

.social {
  i {
    width: 35px;
    height: 30px;
    background-color: transparent;
    text-align: center;
    padding-top: 5px;
    transition: all ease 0.3s;
    -moz-transition: all ease 0.3s;
    -webkit-transition: all ease 0.3s;
    -o-transition: all ease 0.3s;
    -ms-transition: all ease 0.3s;
  }

  ul li {
    margin: 5px;
    list-style: none outside none;
    display: inline-block;
  }
}

.fa {
  color: #774b27;
  color: rgba(45, 45, 45, 0.45);
  font-size: 20px;
  margin: 0 1rem;
}

.fa-refresh.animate {
  -webkit-animation-name: rotate;
        animation-name: rotate;
	-webkit-animation-duration: 250ms;
	        animation-duration: 250ms;
}
@-webkit-keyframes rotate {
	100% { -webkit-transform: rotate(180deg); }
}
@keyframes rotate {
	100% { transform: rotate(180deg); }
}

i:hover,
i:focus {
  color: #662e1c;
}

h1,
h2 {
  font-family: Bitter, sans-serif;
}

.header {
  background: linear-gradient(135deg, #db9501 15%, #c05805 50%, #2e2300 100%);
  color: #662e1c;
  height: 100%;
  text-align: center;
  padding-top: 2.6rem;
}

.cover-heading {
  font-size: 46px;
  margin-bottom: 2.6rem;
  text-shadow: 1px 1px 5px rgba(125, 125, 125, 0.1),
    2px 2px 5px rgba(125, 125, 125, 0.1), 3px 3px 5px rgba(125, 125, 125, 0.1),
    4px 4px 5px rgba(125, 125, 125, 0.1), 5px 5px 5px rgba(125, 125, 125, 0.1);
}

.header p {
  color: #662e1c;
  font-size: 26px;
  margin: 2.6rem 0;
}

.panel {
  background: #d38c23;
  background: rgba(220, 220, 220, 0.15);
  border-radius: 0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14),
    0 2px 1px -1px rgba(0, 0, 0, 0.12);
}

.panel-default {
  border-color: #d28002;
  border-color: rgba(221, 221, 221, 0.1);
}

.panel-body {
  position: relative;
  height: 250px;
}

.panel-footer {
  border: none;
  background-color: transparent;
}

.fade-transition {
  transition: opacity 0.25s ease;
}

.fade-enter,
.fade-leave {
  opacity: 0;
}

@media (max-width: 500px) {
  .header {
    padding-top: 1.2rem;
  }
  .panel-body {
    height: 450px;
  }
}

              
            
!

JS

              
                var app = new Vue({
  el: '#app',
  data: {
    toggle: 0,
    view: 'q1',
    isVisible: true,
    quote1: '',
    quote2: '',
    quotes: ["Don't complain about the snow on your neighbour's roof when your own doorstep is unclean. — Confucious",
      "A great man shows his greatness by the way he treats little men. ― Thomas Carlyle",
      "I can't imagine a man really enjoying a book and reading it only once. ― C.S. Lewis",
      "If I find in myself a desire which no experience in this world can satisfy, the most probable explanation is that I was made for another world. ― C.S. Lewis",
      "They that be whole need not a physician, but they that are sick.",
      "Every kingdom divided against itself is brought to desolation, and every city or house divided against itself shall not stand.",
      "He is no fool who gives what he cannot keep to gain that which he cannot lose. ― Jim Elliot",
      "The journey of a thousand miles begins with a single step. ― Laozi",
      "Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime.",
      "No! Try not. Do... or do not. There is no try. ― Yoda",
      "It's our moments of struggle that define us. How we handle them is what matters. ― Allan Trumbull",
      "A neutron walks into a bar and asks how much for a drink. The barman replies for you no charge. ― Sheldon Cooper",
      "Sheldon: 'Well, this is confusing for me. But I don't want to stand in the way of your happiness. So, I will condemn you internally while maintaining an outward appearance of acceptance.'",
      "My fists are not up here because I am milking a giant invisible cow. ― Sheldon Cooper",
      "Almost every successful person begins with two beliefs...the future can be better than the present, and I have the power to make it so. ― Zig Ziglar",
      "Remember that failure is an event, not a person. ― Zig Ziglar",
      "The more you complain about your problems, the more problems you will have to complain about. ― Zig Ziglar",
      "Far too many people have no idea what they can do because all they've been told is what they can't do. ― Zig Ziglar",
      "The master has failed more times than the beginner has even tried. ― Zig Ziglar",
      "Your character should always be stronger than your circumstances. ― Zig Ziglar",
      "All our dreams can come true if we have the courage to pursue them. ― Walt Disney"
    ]
  },
  ready: function() {
    var random_no = 0;
    random_no = Math.floor(Math.random() * this.quotes.length);
    this.quote1 = this.quotes[random_no];
    random_no = Math.floor(Math.random() * this.quotes.length);
    this.quote2 = this.quotes[random_no];
  },
  computed: {
    urlQuote: function() {
      return encodeURI(this.quote1);
    },
  },
  components: {
    'q1': {
      props: { dataQuote1: String },
      template: '<p>{{ dataQuote1 }}</p>'
    },
    'q2': {
      props: { dataQuote2: String },
      template: '<p>{{ dataQuote2 }}</p>'
    }
  },
  methods: {
    newQuote: function() {
      var icon = document.getElementById('rotateRefresh');
      var random_no = 0;
      this.toggle = !this.toggle;
      this.toggle == 0 ? this.view = 'q1': this.view = 'q2';
      
      random_no = Math.floor(Math.random() * this.quotes.length);
      this.quote1 = this.quotes[random_no];
      random_no = Math.floor(Math.random() * this.quotes.length);
      this.quote2 = this.quotes[random_no];
      
      icon.classList.add('animate');
        setTimeout(function(){
        	icon.classList.remove('animate');
        }, 400);
    }
  }
})
              
            
!
999px

Console