File tree Expand file tree Collapse file tree
static/homepage/js/random-quotes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11function init ( ) {
2- // Show the first quote
32 getRandomQuote ( ) ;
43
5- // Change quote every RANDOM_QUOTE
4+ // Change quote every RANDOM_QUOTE_INTERVAL
65 setInterval ( function ( ) { getRandomQuote ( ) ; } , random_quote_interval ) ;
76
8- // Retrieve random quote using the api
97 function getRandomQuote ( ) {
108 // Get the text and author span id
119 let text = document . getElementById ( "quote-text" ) ;
@@ -17,9 +15,23 @@ function init() {
1715 text . textContent = data . result . text
1816 author . textContent = data . result . author
1917 } )
18+ // Animate display
19+ let quote_block = document . getElementById ( "quote-block" ) ;
20+ fadeInQuote ( quote_block )
2021 }
2122}
2223
24+ function fadeInQuote ( quote , duration = 2000 ) {
25+ quote . animate ( [
26+ { // from
27+ opacity : 0 ,
28+ } ,
29+ { // to
30+ opacity : 1 ,
31+ }
32+ ] , duration ) ;
33+ }
34+
2335export default {
2436 init
2537}
Original file line number Diff line number Diff line change 3737
3838 < img class ="logo " src ="{{ assets|get_asset_key:'commons/img/logo_text.png' }} " alt ="Python Canarias " />
3939
40- < div class ="quote is-centered ">
40+ < div id =" quote-block " class ="quote is-centered ">
4141 < p >
4242 < i class ="fas fa-quote-left "> </ i >
4343 < span id ="quote-text ">
You can’t perform that action at this time.
0 commit comments