Apple TV style hover
How do I make an apple tv style hover?
Inspired by the new Apple TV UI and the fun rotation effect.. What is a apple tv style hover? How do you make a apple tv style hover? This script and codes were developed by Rosh Jutherford on 04 September 2022, Sunday.
Apple TV style hover - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Apple TV style hover</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel='stylesheet prefetch' href='css/https___codepen_io_the_ru.css'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ html { background: #e9e9e4; -webkit-font-smoothing: antialiased;
}
/*section*/.top-movies { font-size: 0; background: #bfd5e0; background: radial-gradient( 400px at 50%, #d9dbd8 0%, #bfd5e0 100% ); padding: 45px 0; box-shadow: inset 0 -5px 8px 0 rgba( 0, 0, 0, 0.05 ); // Borrowed from https://css-tricks.com/i-left-my-system-fonts-in-san-francisco/: font-family: system, -apple-system, ".SFNSDisplay-Regular", HelveticaNeue, LucidaGrande;
}
/*h1*/.top-movies__title { font-size: 22px; color: #444e50; margin: 0 0 14px; text-shadow: 0 2px 1px rgba( 255, 255, 255, 0.1 );
}
.section-content { width: 94%; margin: 0 auto; @include breakpoint( 1022px ) { width: 100%; max-width: 960px; }
}
/*article*/.card { box-shadow: 0 3px 3px 0 rgba( 0, 0, 0, 0.3 ); position: relative; width: 150px; margin: 0 auto; transition: box-shadow 0.15s ease-out, transform 0.25s ease; perspective: 500px; perspective-origin: 50% 50%; transform-style: preserve-3d; &:hover { transform: scale( 1.1 ); box-shadow: none; } &.hover--ending { transition: box-shadow 0.5s ease; } @include breakpoint( 540px ) { display: inline-block; } + .card { margin: 45px auto 0; @include breakpoint( 540px ) { margin: 0 0 0 25px; } }
}
/*span*/.highlight { display: block; position: absolute; width: 100px; height: 100px; top: 0; right: 0; opacity: 0; z-index: 3; transition: opacity 0.25s ease; background: radial-gradient( 60px at 50%, rgba( 255, 255, 255, 0.13 ) 0%, rgba( 255, 255, 255, 0 ) 100% );
}
/*a*/.card__link { display: block; position: relative; width: 150px; height: 228px; overflow: hidden; transform-origin: center center; transform-style: preserve-3d;
}
/*img*/.card__image { position: absolute; width: 100%; height: 100%; top: 0; left: 0; object-fit: cover;
}
/*h2*/.card__title { font-size: 14px; width: 100%; height: 24px; line-height: 24px; text-align: center; color: #FFFFFF; position: absolute; left: 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; opacity: 0; transition: opacity 0.15s ease-in; text-shadow: 0 2px 2px rgba( 0, 0, 0, 0.06 ); /*article*/.card:hover & { opacity: 0.8; }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <section class="top-movies"> <div class="section-content"> <h1 class='top-movies__title'>Top Movies</h1> <article class="card"> <a href="#" class="card__link"> <span class="highlight"></span> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/images.jpeg" alt="Mad Max: Fury Road" class="card__image" /> </a> <h2 class='card__title'>Mad Max: Fury Road</h2> </article> <article class="card"> <a href="#" class="card__link"> <span class="highlight"></span> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/images_(1).jpeg" alt="Avengers: Age of Ultron" class="card__image" /> </a> <h2 class='card__title'>Avengers: Age of Ultron</h2> </article> <article class="card"> <a href="#" class="card__link"> <span class="highlight"></span> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/images_(2).jpeg" alt="Furious 7" class="card__image" /> </a> <h2 class='card__title'>Furious 7</h2> </article> </div>
</section> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Apple TV style hover - Script Codes CSS Codes
html { background: #e9e9e4; -webkit-font-smoothing: antialiased;
}
/*section*/.top-movies { font-size: 0; background: #bfd5e0; background: radial-gradient( 400px at 50%, #d9dbd8 0%, #bfd5e0 100% ); padding: 45px 0; box-shadow: inset 0 -5px 8px 0 rgba( 0, 0, 0, 0.05 ); // Borrowed from https://css-tricks.com/i-left-my-system-fonts-in-san-francisco/: font-family: system, -apple-system, ".SFNSDisplay-Regular", HelveticaNeue, LucidaGrande;
}
/*h1*/.top-movies__title { font-size: 22px; color: #444e50; margin: 0 0 14px; text-shadow: 0 2px 1px rgba( 255, 255, 255, 0.1 );
}
.section-content { width: 94%; margin: 0 auto; @include breakpoint( 1022px ) { width: 100%; max-width: 960px; }
}
/*article*/.card { box-shadow: 0 3px 3px 0 rgba( 0, 0, 0, 0.3 ); position: relative; width: 150px; margin: 0 auto; transition: box-shadow 0.15s ease-out, transform 0.25s ease; perspective: 500px; perspective-origin: 50% 50%; transform-style: preserve-3d; &:hover { transform: scale( 1.1 ); box-shadow: none; } &.hover--ending { transition: box-shadow 0.5s ease; } @include breakpoint( 540px ) { display: inline-block; } + .card { margin: 45px auto 0; @include breakpoint( 540px ) { margin: 0 0 0 25px; } }
}
/*span*/.highlight { display: block; position: absolute; width: 100px; height: 100px; top: 0; right: 0; opacity: 0; z-index: 3; transition: opacity 0.25s ease; background: radial-gradient( 60px at 50%, rgba( 255, 255, 255, 0.13 ) 0%, rgba( 255, 255, 255, 0 ) 100% );
}
/*a*/.card__link { display: block; position: relative; width: 150px; height: 228px; overflow: hidden; transform-origin: center center; transform-style: preserve-3d;
}
/*img*/.card__image { position: absolute; width: 100%; height: 100%; top: 0; left: 0; object-fit: cover;
}
/*h2*/.card__title { font-size: 14px; width: 100%; height: 24px; line-height: 24px; text-align: center; color: #FFFFFF; position: absolute; left: 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; opacity: 0; transition: opacity 0.15s ease-in; text-shadow: 0 2px 2px rgba( 0, 0, 0, 0.06 ); /*article*/.card:hover & { opacity: 0.8; }
}
Apple TV style hover - Script Codes JS Codes
$card = $( '.card' );
$card.on( 'mousemove', function( e ) { var $this = $( this ), eX = e.offsetX, eY = e.offsetY, dim = this.getBoundingClientRect(); w = dim.width/2, h = dim.height/2, tiltLimit = 15, posX = ( h - eY ) * ( tiltLimit / h ); posY = ( w - eX ) * ( tiltLimit / w ) * -1; $this.find( 'a' ).css({ 'transform': 'rotateX( ' + posX + 'deg ) rotateY( ' + posY + 'deg )', 'box-shadow': ( posY * -1 ) + 'px ' + ( posX + 14 ) + 'px 34px 0 rgba( 0, 0, 0, 0.1 )' }); $this.find( '.highlight' ).css({ 'opacity': 1, 'transform': 'translate3d( ' + ( posX * -4 ) + 'px, ' + ( posY * -4 ) + 'px, ' + '0 )' });
});
$card.mouseleave( function( e ) { var $el = $( this ).find( 'a' ); $el.removeAttr( 'style' ).addClass( 'hover--ending' ); setTimeout( function() { $el.removeClass( 'hover--ending' ); }, 500 ); $el.find( '.highlight' ).removeAttr( 'style' );
});
Developer | Rosh Jutherford |
Username | the_ruther4d |
Uploaded | September 04, 2022 |
Rating | 4.5 |
Size | 5,419 Kb |
Views | 42,504 |
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!
Name | Size |
Apple iPhone 5s style scrolling | 4,740 Kb |
A Pen by Rosh Jutherford | 4,410 Kb |
Game-Style Header | 4,486 Kb |
Flat Logo by Henrik Dahlheim | 2,580 Kb |
Download Button | 4,308 Kb |
Flat Range Sliders | 2,467 Kb |
RvV 2 | 3,115 Kb |
Flame by Kenji Droullard | 3,359 Kb |
Responsive CSS Menu | 2,559 Kb |
Pre-loader 1 by Chris Hall | 2,658 Kb |
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!
Name | Username | Size |
Simple Carousel Pure CSS | Dangvanthanh | 4,080 Kb |
E-mail Template | SoloMDFK | 4,871 Kb |
Shopping cart | Andiio | 6,581 Kb |
Drag in vanilla js using dotval math instead of translate | Paulq | 2,662 Kb |
RPG Style Text Dialogue | Odylic | 2,635 Kb |
Fun animations with CSS3 | Minimalmonkey | 2,360 Kb |
Flip test | Madhes | 1,635 Kb |
Svg animation draw | SzymonDziewonski | 5,545 Kb |
Cool Page Split Effect | Anthonyadamski | 6,128 Kb |
Simple CSS loader. | Cabrera | 2,574 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!