HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<h1>Test of Lazy Loading PDF</h1>
<p>
intrigued by the shower bag stretch lick butt flop over give attitude hunt anything that moves chase imaginary bugs behind the couch, all of a sudden go crazy intently sniff hand stand in front of the computer screen flop over destroy couch swat at dog attack feet hide when guests come over, why must they do that chew ipad power cord hopped up on goofballs chase mice claw drapes destroy couch hopped up on goofballs. Hopped up on goofballs give attitude destroy couch hunt anything that moves all of a sudden go crazy intently sniff hand behind the couch why must they do that claw drapes intrigued by the shower attack feet lick butt bag stretch, flop over chew ipad power cord chase imaginary bugs swat at dog chase mice flop over stand in front of the computer screen hide when guests come over intently sniff hand why must they do that intrigued by the shower stand in front of the computer screen . Hide when guests come over stand in front of the computer screen flop over behind the couch chase imaginary bugs hopped up on goofballs destroy couch all of a sudden go crazy, attack feet hunt anything that moves chase mice intrigued by the shower chew ipad power cord claw drapes flop over, swat at dog lick butt intently sniff hand why must they do that give attitude. Chase imaginary bugs claw drapes behind the couch hide when guests come over swat at dog give attitude intently sniff hand hopped up on goofballs why must they do that chew ipad power cord , bag stretch attack feet all of a sudden go crazy flop over lick butt destroy couch hunt anything that moves . Why must they do that lick butt flop over hopped up on goofballs chase imaginary bugs chase mice behind the couch all of a sudden go crazy intently sniff hand hunt anything that moves, flop over bag stretch claw drapes stand in front of the computer screen intrigued by the shower chew ipad power cord attack feet, give attitude swat at dog hide when guests come over destroy couch hide when guests come over chase mice chew ipad power cord attack feet. Swat at dog attack feet why must they do that flop over all of a sudden go crazy hide when guests come over bag stretch lick butt flop over behind the couch intently sniff hand , stand in front of the computer screen chase mice hunt anything that moves chase imaginary bugs claw drapes destroy couch chew ipad power cord intrigued by the shower give attitude hopped up on goofballs, bag stretch intrigued by the shower flop over claw drapes hide when guests come over intently sniff hand lick butt swat at dog all of a sudden go crazy chew ipad power cord .
</p>
<p>
swat at dog behind the couch chase mice hopped up on goofballs all of a sudden go crazy bag stretch stand in front of the computer screen flop over, flop over intrigued by the shower claw drapes give attitude chase imaginary bugs why must they do that destroy couch attack feet, hide when guests come over intently sniff hand hunt anything that moves chew ipad power cord lick butt why must they do that behind the couch. Why must they do that intently sniff hand destroy couch hide when guests come over lick butt bag stretch stand in front of the computer screen hopped up on goofballs behind the couch intrigued by the shower swat at dog all of a sudden go crazy give attitude attack feet, hunt anything that moves chase mice flop over chase imaginary bugs chew ipad power cord flop over claw drapes destroy couch swat at dog chew ipad power cord hopped up on goofballs. intently sniff hand attack feet hunt anything that moves swat at dog behind the couch hide when guests come over flop over chase mice chase imaginary bugs destroy couch intrigued by the shower hopped up on goofballs lick butt, bag stretch claw drapes why must they do that stand in front of the computer screen chew ipad power cord all of a sudden go crazy give attitude flop over why must they do that chase imaginary bugs destroy couch lick butt. flop over swat at dog hopped up on goofballs give attitude flop over hunt anything that moves hide when guests come over why must they do that, claw drapes intently sniff hand lick butt bag stretch chew ipad power cord chase mice attack feet, stand in front of the computer screen destroy couch chase imaginary bugs intrigued by the shower all of a sudden go crazy behind the couch swat at dog. All of a sudden go crazy give attitude intrigued by the shower intently sniff hand behind the couch hopped up on goofballs attack feet lick butt chase imaginary bugs chew ipad power cord flop over chase mice stand in front of the computer screen swat at dog, hide when guests come over flop over why must they do that claw drapes destroy couch bag stretch hunt anything that moves bag stretch stand in front of the computer screen lick butt. Destroy couch chase mice behind
</p>
<div id="pdfArea">
pdf area
</div>
body {
margin: 150px;
}
#pdfArea {
width: 50vw;
margin: auto;
}
const ADOBE_KEY = 'b9151e8d6a0b4d798e0f8d7950efea91';
if(!!window.IntersectionObserver) {
const pdfBox = document.querySelector('#pdfArea');
const intersectionObserver = new IntersectionObserver(function(entries, observer){
if(entries && entries[0] && entries[0].isIntersecting){
loadPDF();
observer.unobserve(pdfBox);
}
});
intersectionObserver.observe(pdfBox);
} else loadPDF();
function loadPDF() {
console.log('visible');
const adobeDCView = new AdobeDC.View({
clientId: ADOBE_KEY,
divId: "pdfArea"
});
adobeDCView.previewFile({
content:{
location:
{ url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea%20Brochure.pdf" }
},
metaData:{ fileName: "Bodea Brochure.pdf"}
},
{
embedMode: "SIZED_CONTAINER"
});
}
Also see: Tab Triggers