Sketchy Box

Developer
Size
3,033 Kb
Views
52,624

How do I make an sketchy box?

What is a sketchy box? How do you make a sketchy box? This script and codes were developed by Mnicpt on 30 July 2022, Saturday.

Sketchy Box Previews

Sketchy Box - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Sketchy Box</title> <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="wrapper"> <div class="sketchy box"> <div class="content"> Content section with a hidden overflow when there is a massive amount of text </div> <div class="ellipsis">...</div> </div> <div class="sketchy box"> <div class="content"> Some other content that </div> <div class="ellipsis">...</div> </div>
</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>

Sketchy Box - Script Codes CSS Codes

.wrapper { margin: 20px auto; width: 80%; text-align: center;
}
.sketchy { margin: 20px; font-size: 12px; float: left;
}
.sketchy.box { position: relative; box-sizing: border-box; display: inline-block; padding: 1.4%; width: 100px; height: 100px;
}
.sketchy.box .content { position: relative; width: 100%; height: 96%; max-height: 100px; overflow: hidden; text-overflow: ""; z-index: 100;
}
.ellipsis { display: none; content: '...'; position: absolute; bottom: 17px; right: 2px; width: 2em; height: 1em;
}
.sketchy:before { position: absolute; top: 3px; left: 3px; width: 88px; height: 96px; border-left: 3px double #444; border-right: 3px double #444; transform: rotate(-1deg); -webkit-transform: rotate(-1deg); -moz-transform: rotate(-1deg); content: ""; z-index: 50;
}
.sketchy:after { position: absolute; background-color: rgba(255, 212, 84, 0.5); top: 8px; left: 1px; width: 98px; height: 80px; border-top: 3px double #444; border-bottom: 3px double #444; transform: rotate(-1deg); -webkit-transform: rotate(-1deg); -moz-transform: rotate(-1deg); content: ""; z-index: 50;
}

Sketchy Box - Script Codes JS Codes

(function() { var content = document.querySelectorAll(".sketchy.box .content"), box = document.querySelectorAll(".sketchy.box"); for(var i = 0; i < content.length; i++) { var thisContent = content[i], clientHeight = thisContent.clientHeight, text = thisContent.nextSibling, boxHeight = box[i].clientHeight, fontSize = window.getComputedStyle(content[0]).getPropertyValue("font-size").split("px")[0], rows = (boxHeight - (fontSize * 2)) / fontSize, contentLength = thisContent.innerHTML.split("").length; if (contentLength > parseInt(fontSize, 0) * rows) { thisContent.nextSibling.nextSibling.style.display = "block"; } else { thisContent.nextSibling.nextSibling.style.display = "none"; } }
})();
Sketchy Box - Script Codes
Sketchy Box - Script Codes
Home Page Home
Developer Mnicpt
Username mnicpt
Uploaded July 30, 2022
Rating 3
Size 3,033 Kb
Views 52,624
Do you need developer help for Sketchy Box?

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!

Mnicpt (mnicpt) Script Codes
Create amazing blog posts 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!