Director
Hallo,
ich habe mal wieder ein kleines Problem mit Wordpress. Und zwar möchte ich den Header, mit Wordpress dynamisch gestalten. Es sollen die letzten vier Bilder aus einer bestimmten Kategorie angezeigt werden. Wenn man über eines der Bilder hovert soll es groß dargestellt werden und der Text neben dem großen Bild soll natürlich auch dynamisch angepasst werden. Mit festen Bildern funktioniert das schon sehr gut, aber wie kann ich das nun an Wordpress anpassen? Ich hoffe jemand hat Lust sich das anzugucken Danke schon mal dafür!
Hier der relevante Code:
HTML:
Javascript:
CSS:
ich habe mal wieder ein kleines Problem mit Wordpress. Und zwar möchte ich den Header, mit Wordpress dynamisch gestalten. Es sollen die letzten vier Bilder aus einer bestimmten Kategorie angezeigt werden. Wenn man über eines der Bilder hovert soll es groß dargestellt werden und der Text neben dem großen Bild soll natürlich auch dynamisch angepasst werden. Mit festen Bildern funktioniert das schon sehr gut, aber wie kann ich das nun an Wordpress anpassen? Ich hoffe jemand hat Lust sich das anzugucken Danke schon mal dafür!
Hier der relevante Code:
HTML:
HTML:
<div id="header">
<a href="#" title="##"><img id="main" src="img/only-god-forgives__130525103700.jpg" alt="###" class="featured-main"></a>
<div class="infoBlock">
<div class="textfeld">
<h3>The Place Beyond the Pines</h3>
<p>Dies ist ein kleiner Text über The Place beyond the Pines mit Eva Mendez, Bradley Cooper und Ryan Gosling.</p>
</div>
</div>
<div class="clearfix">
</div>
<div id="one" class="divider highlight">
</div>
<div id="two" class="divider">
</div>
<div id="three" class="divider">
</div>
<div id="four" class="divider">
</div>
<div class="clearfix">
</div>
<div class="imageChooser">
<a href="#" title="##" onmouseover="changeImage('one');">
<img src="img/only-god-forgives__130525103700.jpg" alt="###" id="oneImg" class="featured-secondary highlight">
</a>
<a href="#" title="##" onmouseover="changeImage('two');">
<img src="img/The-Place-Beyond-The-Pines.jpg" alt="###" id="twoImg" class="featured-secondary">
</a>
<a href="#" title="##" onmouseover="changeImage('three');">
<img src="img/bioshock.jpg" alt="###" id="threeImg" class="featured-secondary">
</a>
<a href="#" title="##" onmouseover="changeImage('four');">
<img src="img/wueste.jpg" alt="###" id="fourImg" class="featured-secondary">
</a>
</div>
</div>
Javascript:
HTML:
<script type="text/javascript">
function changeImage(HighlightedID) {
if(HighlightedID == 'one') {
document.getElementById('main').src='img/only-god-forgives__130525103700.jpg';
document.getElementById('one').className = 'divider highlight';
document.getElementById('two').className = 'divider';
document.getElementById('three').className = 'divider';
document.getElementById('four').className = 'divider';
document.getElementById('oneImg').className = 'featured-secondary highlight';
document.getElementById('twoImg').className = 'featured-secondary';
document.getElementById('threeImg').className = 'featured-secondary';
document.getElementById('fourImg').className = 'featured-secondary';
}
else if(HighlightedID == 'two') {
document.getElementById('main').src='img/The-Place-Beyond-The-Pines.jpg';
document.getElementById('one').className = 'divider';
document.getElementById('two').className = 'divider highlight';
document.getElementById('three').className = 'divider';
document.getElementById('four').className = 'divider';
document.getElementById('oneImg').className = 'featured-secondary';
document.getElementById('twoImg').className = 'featured-secondary highlight';
document.getElementById('threeImg').className = 'featured-secondary';
document.getElementById('fourImg').className = 'featured-secondary';
}
else if(HighlightedID == 'three') {
document.getElementById('main').src='img/bioshock.jpg';
document.getElementById('one').className = 'divider';
document.getElementById('two').className = 'divider';
document.getElementById('three').className = 'divider highlight';
document.getElementById('four').className = 'divider';
document.getElementById('oneImg').className = 'featured-secondary';
document.getElementById('twoImg').className = 'featured-secondary';
document.getElementById('threeImg').className = 'featured-secondary highlight';
document.getElementById('fourImg').className = 'featured-secondary';
}
else if(HighlightedID == 'four') {
document.getElementById('main').src='img/wueste.jpg';
document.getElementById('one').className = 'divider';
document.getElementById('two').className = 'divider';
document.getElementById('three').className = 'divider';
document.getElementById('four').className = 'divider highlight';
document.getElementById('oneImg').className = 'featured-secondary';
document.getElementById('twoImg').className = 'featured-secondary';
document.getElementById('threeImg').className = 'featured-secondary';
document.getElementById('fourImg').className = 'featured-secondary highlight';
}
}
</script>
CSS:
HTML:
#header{float:left; width:960px; height:540px; background-color:#333;}
.infoBlock{height:410px; width:33%; background-image:url(img/textfeld.png); z-index:100; position:relative; bottom:544px;
color:#FFF;}
.textfeld{position:absolute; bottom:20px; padding:20px;}
.imageChooser{position:relative; bottom:544px; height:135px; background-color:#FFF;}
.divider{float:left; width:25%; height:5px; background-color:#FFF; position:relative; bottom:544px;}
.featured-main{width:100%;}
.featured-secondary{width:25%; float:left; opacity:0.7;}
.highlight{opacity:1; background-color:#09F; transition-property:opacity; transition-duration:0.2s;}
Zuletzt bearbeitet: