2014-01-13 29 views
0

我目前正在一個wordpress模板,其中標題的帖子被隱藏,並懸停在帖子上,它應該顯示在瀏覽器的底部。爲了簡化,後有這樣的結構:WordPress的:在懸停加載職位的標題到一個特定的DIV

<article class="post"> 
    <header class="article-header"> 
     <h2 class="entry-title"> 
     Post Title 
     </h2> 
    </header> 
    <section class="entry-content"> 
     Post Content 
    </section> 
</article> 

基本上,我想有一個固定在身上,那對瀏覽器的底部,並在一個職位徘徊,其子的內容坐鎮元素被傳入。到目前爲止,我的方法是將所有元素不斷固定到瀏覽器底部(隱藏)並懸停,每個元素都將顯示出來。這導致了一些問題,我想我可能會更容易有一個空格,它只是抓住標題信息。

任何人都可以幫助我,也許用jQuery或PHP?

謝謝!

回答

0

你的意思是,這樣的事情? http://jsfiddle.net/rKhqT/5/

HTML:

<article class="post"> 
    <header class="article-header"> 
     <h2 class="entry-title"> 
     Post Title 
     </h2> 
    </header> 
    <section class="entry-content"> 
     Post Content 
    </section> 
</article> 
<footer></footer> 

CSS:

html, body { 
    margin: 0; 
    height: 100%; 
} 

.entry-title { 
    display: none; 
} 
footer { 
    position: fixed; 
    left: 0; 
    bottom:0; 
    width: 100%; 
    height: 30px; 
    border: 1px solid black; 
} 

JS(需要的jQuery):

$(document).ready(function() { 
    $('article.post').mouseover(function() { 
     $('footer').text($(this).find('h2').text()); 
    }); 
    $('article.post').mouseout(function() { 
     $('footer').text(''); 
    });  
}); 
+0

完美的作品,謝謝! – R4ttlesnake

相關問題