Skip to content

Instantly share code, notes, and snippets.

@otakupahp
Last active May 5, 2022 21:26
Show Gist options
  • Save otakupahp/604cf2e03fc4f94bddf92a9daa44694d to your computer and use it in GitHub Desktop.
Save otakupahp/604cf2e03fc4f94bddf92a9daa44694d to your computer and use it in GitHub Desktop.
Add a shadow text with the desired content to a H2
// To add the text dynamically, use a class (overlay-title) in the h2 to catch the object and modify h2::before for "overlay-title-shadow"
(function( $ ) {
'use strict';
// Window loaded
$(window).on("load",function(){
const postTitleObj = $( '.overlay-title h2' );
if( 0 < postTitleObj.length ) {
postTitleObj.before( '<div class="overlay-title-shadow">' + postTitleObj.html() + '</div>' );
}
});
})( jQuery );
h2:before {
content: "PLAYING SERIUSLY";
position: absolute;
color: #DD3131;
opacity: .1;
font-size: 12rem;
top: 50%;
left: 55%;
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
font-weight: 700;
z-index: -1;
width: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment