4

几个月前,我发布了一个关于如何在将鼠标悬停在图像上时显示标题的问题。

这是线程:

不明白悬停图像时如何显示标题

问题是当我使用 TinyMce 编辑标题时,它不会显示标题悬停。相反,它不显示任何标题,它只是悬停。

这是编辑端(我缩短了它):

 <script language="javascript" type="text/javascript">//<![CDATA[
  tinyMCE.init({
        // General options
        mode: "textareas",
        elements : "ajaxfilemanager",
        theme : "advanced",
});
//]]</script>

这是输出:

<html> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>

<style>
#caption { display: none;font:12px Times New Roman;}
img:hover + #caption { position: absolute; display: block;}
.caption { display:none; text-decoration: none; font:12px Times New Roman;}
.image-with-caption:hover .caption {display: block; text-decoration: none;}
a:hover { text-decoration: none; } 
</style>

<table width="100%">
<tr>
<td>
<?php echo(stripslashes($_POST['content'])); ?>
</td>
</tr>
</table>

</body>
</html>

这是我将代码复制并粘贴到 TinyMCE 中的输入:

 <table width="100%">
 <tr>
 <td>
 <div class="image-with-caption">
 <a href="images/artistc.php">
 <img src="images/imagec08.jpg" style="width:209px" />
 <p id="caption">Caption 3</p>
 </a>  
 </div>
 </td>
 <td>
 <div class="image-with-caption">
 <a href="images/artistb.php">
 <img src="images/imageb12.jpg" style="width:195px" />
 <p id="caption">Caption 5</p> 
 </a>
 </div>
 </td>
 <td>
 <div class="image-with-caption">
 <a href="images/artista.php">
 <img src="images/imagea02.jpg" style="width:260px" />
 <p id="caption">Caption 4</p>
 </a> 
 </div>
 </td>
 </tr>
 </table>

任何建议和意见将不胜感激。我只是想知道为什么它不显示标题。

4

1 回答 1

1

I don't completely understand your question, but I see you have several tags with same id. That is not allowed. Maybe if you fix that, it helps to fix the issue. You should replace the id="caption" by class="caption" (or anything else), and then, modify your css replacing #caption by .caption

于 2012-08-27T03:15:10.397 回答