xorg1990
New member
Hi, ich habe mir mittels css ein Play Symbol erstellt allerdings Probleme damit.
Problem 1: das Play symbol (das Dreieck) ist nicht mittig im kreis es will mir nicht gelingen das es mittig wird.
Problem 2: Wenn man den Kreis hovered wird der Durchmesser größer. Klick man allerdings auf das Symbol so das das Pause Symbol kommt,
funktioniert die Animation nicht mehr. Warum??
Noch was ein anchor Tag ohne href ist ja nicht valide. Wenn ich aber den anchor die role="button" gebe schon? oder nicht?
Habe das jetzt schon öfter in Quelltexten so gesehen.
Problem 1: das Play symbol (das Dreieck) ist nicht mittig im kreis es will mir nicht gelingen das es mittig wird.
Problem 2: Wenn man den Kreis hovered wird der Durchmesser größer. Klick man allerdings auf das Symbol so das das Pause Symbol kommt,
funktioniert die Animation nicht mehr. Warum??
HTML:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<style type="text/css">
#playButton{
position: absolute;
top:100px;
left: 120px;
width: 100px;
height: 150px;
}
.play {
display: block;
width: 0;
height: 0;
border-top: 35px solid transparent;
border-bottom: 35px solid transparent;
border-left: 55px solid #2c3e50;
position: relative;
z-index: 1;
transition: all 0.3s;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
}
.play:before {
content: '';
position: absolute;
top: -75px;
left: -88px;
bottom: -50px;
right: -35px;
border-radius: 50%;
border: 5px solid #2c3e50;
z-index: 2;
transition: all 0.3s;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
}
.play:after {
content: '';
opacity: 0;
transition: opacity 0.6s;
-webkit-transition: opacity 0.6s;
-moz-transition: opacity 0.6s;
}
.play:hover:before, .play:focus:before {
transform: scale(1.1);
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
}
.play.active {
border-color: transparent;
}
.play.active:after {
content: '';
opacity: 1;
width: 40px;
height: 60px;
background: #2c3e50;
position: absolute;
right: 2px;
top: -40px;
border-left: 10px solid #2c3e50;
box-shadow: inset 30px 0 0 0 white;
}
</style>
<script>
function run() {
const icon = $('.play');
icon.click(function() {
icon.toggleClass('active');
return false;
});
}
</script>
</head>
<body onload="run()">
<div id="playButton"><a role="button" href="#" title="Play/Pause" class="play"></a></div>
</body>
</html>
Noch was ein anchor Tag ohne href ist ja nicht valide. Wenn ich aber den anchor die role="button" gebe schon? oder nicht?
Habe das jetzt schon öfter in Quelltexten so gesehen.