chiggins Posted February 5, 2020 Share Posted February 5, 2020 Site URL: https://opossum-apricot-tzsp.squarespace.com/ I'm trying to create a text block that will generate a different sentence every time the home page is visited/refreshed. I'm very new to coding and I'm not sure where to start. Is there some custom css I can use to accomplish this? I have tried creating a blog post and then a summary carousel with just the headers, but the formatting of the text doesn't match with the H1 of the rest of the site. I've considered just creating PNG files of all the text and then trying the carousel again, but I'm afraid the formatting would look strange on mobile with the image sizing. Any help would be greatly appreciated. Link to comment
tuanphan Posted February 9, 2020 Share Posted February 9, 2020 Use this code <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> var textToShow = ['text1', 'text2', 'text3', 'text4'] $(document).ready(function() { $("h4").html(textToShow[Math.floor(Math.random()*textToShow.length)]); }); </script> replace h4 with text block class replace text1, text2,... Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.