.neon {
margin: 10px auto;
padding: 40px;
font-size: 75px;
font-family: 'Monoton', cursive;
text-align: center;
text-transform: uppercase;
text-shadow: 0 0 80px red,0 0 30px FireBrick,0 0 6px DarkRed;
color: red;
}
div p { margin:0; }
#neon:hover { text-shadow: 0 0 200px red,0 0 80px FireBrick,0 0 6px DarkRed;
}
#neon {
color: #fff;
text-shadow: 0 0 80px red,0 0 30px FireBrick,0 0 6px DarkRed;
}
#neon span {
animation: upper 11s linear infinite;
}
<div class="neon">
<p id="neon">S<span>l</span>ider</p>
</div>
Добавить комментарий
|
2 ответа
Пример
(function(d) {
"use strict";
window.onscroll = function() {
funcScroll();
};
function funcScroll() {
var topbar = d.getElementsByClassName('neon')[0],
scrollTop = d.body.scrollTop;
if (scrollTop > 150) {
topbar.classList.add('fixed');
} else {
topbar.classList.remove('fixed');
}
}
})(document);
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
min-height: 1500px;
}
.neon {
margin: 10px auto;
padding: 40px;
font-size: 75px;
font-family: 'Monoton', cursive;
text-align: center;
text-transform: uppercase;
text-shadow: 0 0 80px red, 0 0 30px FireBrick, 0 0 6px DarkRed;
color: red;
transition: .3s;
}
div p {
margin: 0;
}
#neon:hover {
text-shadow: 0 0 200px red, 0 0 80px FireBrick, 0 0 6px DarkRed;
}
#neon {
color: #fff;
text-shadow: 0 0 80px red, 0 0 30px FireBrick, 0 0 6px DarkRed;
}
#neon span {
animation: upper 11s linear infinite;
}
.fixed {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
text-align: left;
font-size: 35px;
box-shadow: 0 1px 10px rgba(0,0,0,.2);
}
<div class="neon">
<p id="neon">S<span>l</span>ider</p>
</div>
Eсли используешь jQuery то можно и так:
$(window).scroll(function() {
var topScroll = $(this).scrollTop();
if(topScroll >= 100) {
$('.neon').addClass('fixed');
} else {
$('.neon').removeClass('fixed');
}
});
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
min-height: 1500px;
}
.fixed.neon {
position: fixed;
left: 0;
padding: 2px;
font-size: 30px;
width: 120px;
}
.neon {
position: absolute;
margin: 10px auto;
padding: 40px;
font-size: 75px;
font-family: 'Monoton', cursive;
text-align: center;
text-transform: uppercase;
text-shadow: 0 0 80px red,0 0 30px FireBrick,0 0 6px DarkRed;
color: red;
transition: 0.5s;
}
div p { margin:0; }
#neon:hover { text-shadow: 0 0 20px red,0 0 12px FireBrick,0 0 6px DarkRed;
}
#neon {
color: #fff;
text-shadow: 0 0 80px red,0 0 30px FireBrick,0 0 6px DarkRed;
}
#neon span {
animation: upper 11s linear infinite;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="neon">
<p id="neon">S<span>l</span>ider</p>
</div>