Automatic Quotes

Developer
Size
3,216 Kb
Views
34,408

How do I make an automatic quotes?

Automatically insert pullquotes / blockquotes with a small bit of jQuery and the data-attribute selector.. What is a automatic quotes? How do you make a automatic quotes? This script and codes were developed by Luke Watts on 14 August 2022, Sunday.

Automatic Quotes Previews

Automatic Quotes - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Automatic Quotes</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <h1>Automatic Quotes</h1> <p>This is a test on a simple way to use the data-attribute to deligate a snippet of text to quickly and easily use as a blockquote or pullquote.<p> <p>This is a nice way to keep your HTML a bit more DRY. <span data-quote>DRY! DRY! DRY!</span> Boy it's late! It's like 4am. Why am I still awake? Surely I could've waited and done this in the morning.</p> <p>Anyways, there's two ways to achive this. Version 1: You can simply clone the 'span[data-quote]' element and add a class and then append or prepend it to the nth-child. Version 2 uses wrapInner() to create a blockquote around the text.</p> <p>You could go even further and create an extensive selection of attributes: data-blockquote, data-pullquote, data-left-quote, data-right-quote etc. Once you're css is right you could have unlimited options with ease.<p>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Automatic Quotes - Script Codes CSS Codes

@import url(http://fonts.googleapis.com/css?family=Cinzel+Decorative:900);
@import url(http://fonts.googleapis.com/css?family=Gudea);
*,
*::before,
*::after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
}
body { background-color: #4da2b3;
}
.container { margin: 0 auto; max-width: 40em; text-align: justify;
}
h1 { font-family: "Cinzel Decorative",Georgia, serif; font-size: 4em; text-align: center;
}
p { font-family: "Gudea", sans-serif;
}
.quote { font-family: Georgia, serif; font-size: 2em; font-style: italic; color: white; float: left; text-align: right; margin-right: 0.5em; max-width: 9.5em; padding: 0.5em;
}
.quote::before { content: "\201C";
}
.quote::after { content: "\201D";
}

Automatic Quotes - Script Codes JS Codes

$(document).ready(function() { // Version 1 $('span[data-quote]').clone().prependTo('p:nth-child(3)').addClass('quote'); // Version 2 /** * More specific slection using 'nth' pseudo * selector * Use wrapInner() to wrap the textnode in a * traditional blockquote */ /*$('span[data-quote]').clone().prependTo('p:nth-child(2)').wrapInner('<blockquote />');*/
});
Automatic Quotes - Script Codes
Automatic Quotes - Script Codes
Home Page Home
Developer Luke Watts
Username lukewatts
Uploaded August 14, 2022
Rating 3
Size 3,216 Kb
Views 34,408
Do you need developer help for Automatic Quotes?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Luke Watts (lukewatts) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!