因此,我已將onmouseover應用於Angelina Jolie圖像,以便更改上面顯示「某些示例文本」元素的文本。我怎樣才能讓它恢復原來的文字,內容是「你的每日劑量的Contrabang」。預先感謝您的幫助。該的jsfiddle在這裏http://jsfiddle.net/cntra/VSCXy/9/Onmouseover恢復爲原始文本
HTML:
<div class="columa">
<div id="text-display">
<span id="targetElm">Your Daily Dose of Contrabang</span>
</div>
<div class="morphing-tinting">
<a href="#" class="changeTextClass" rel="targetElm|some sample text">
<span class="image-wrap" style="position:relative; left: 0px; top:0; display:inline-block;
background:url
(http://www.howmuchdotheyweigh.com/wp-content/uploads/2011/02/angelina-jolie.jpg)
no-repeat center center; width: 250px; height: 250px;">
</span></a>
CSS:
#text-display
{top:; position: relative;
display:inline-block;padding:5px 10px;
font-family: sans-serif; font-weight:bold; font-size:50px;
color: white; text-align: center; line-height: 1.2em;margin:0px;
background-color:#E94F78;}
.morphing-tinting .image-wrap {
position: absolute;
-webkit-transition: 1s;
-moz-transition: 1s;
transition: 1s;
-webkit-border-radius: 30em;
-moz-border-radius: 30em;
border-radius: 30em;
}
.morphing-tinting .image-wrap:hover{
-webkit-border-radius: 30em;
-moz-border-radius: 30em;
border-radius: 30em;
}
JS
$('.changeTextClass').hover(function(){
var elmData = $(this).attr('rel').split('|');
$('#'+elmData[0]).text(elmData[1]);
});
var elmData,origText;
$('.changeTextClass').hover(function(){
elmData = $(this).attr('rel').split('|');
origText = $('#'+elmData[0]).text();
$('#'+elmData[0]).text(elmData[1]);
}, function(){
$('#'+elmData[0]).text(origText);
});
大聲笑,我明白了,多謝了這小子。 –