【问题标题】:Firefox/Javascript not displaying image - JoomlaFirefox/Javascript 不显示图像 - Joomla
【发布时间】:2011-06-07 08:01:00
【问题描述】:

我自定义了内容模块,让文章标题在正文前显示图片,正文以两种颜色显示!!

相关部分代码如下:

<h2 class="title">
  <?php if ($params->get('link_titles') && !empty($this->item->readmore_link)) : ?>
<a href="<?php echo $this->item->readmore_link; ?>">
    <span class="image-title2">&nbsp;</span>
    <?php 
    $titles = explode(" ",$this->item->title);

        for ($i=0; $i<count($titles)-1; $i++){
            echo '<span style="float:left;padding-left:7px;color:#303030;">'.$this->escape($titles[$i]).'</span>';

        }?> 
        <span style="color:#06cfef;float:left;padding-left:7px;"><?php echo $this->escape($titles[$i]);?></span></a>
        <div class="clear"></div>
<?php else : ?>
    <div><span class="image-title"></span>
    <?php
        $titles = explode(" ",$this->item->title);
        for ($i=0; $i<count($titles)-1; $i++){
            echo '<div style="float:left;padding-left:7px;">'.$this->escape($titles[$i]).'</div>';

        }?> 
        <div style="color:#06cfef;float:left;padding-left:7px;"><?php echo $this->escape($titles[$i]);?></div></div>
        <div style="clear:both;"></div>
<?php endif; ?>

在 IE 和 Google Chrome 中,所有内容都按需要显示(除了 ie,它有一些定位问题,但我现在不关注那个)

在 Firefox 中,我可以看到内容正确加载,但在页面加载完成之前图像消失了……我在 FF 中禁用了 javascript,所有内容都正确显示,但我就是不明白为什么!!

你可以看看这个网址:http://sostudent.com/joomla/

有人可以帮忙吗?

【问题讨论】:

  • 我在您发布的代码中没有看到任何 img 标记。我认为您至少需要显示构建img 标记的代码。相关的 Javascript 也会有所帮助。
  • 图像被插入到 image-title2 类中。 span.image-title2 { background: url(../images/title-2.jpg) 左上角无重复;宽度:41px;高度:46px;显示:块;向左飘浮;边距顶部:-5px;我的问题是我不明白是哪个 javascript 导致了问题!我刚刚停用了所有 javascripts

标签: javascript html css firefox joomla


【解决方案1】:

我很确定这是由 gantry-buildspans.js 引起的。

似乎需要这个脚本来使标题 h1-h3 的文本颜色不同。这样做时,它会用新的跨度替换标题的内容,span.image-title2 将被丢弃。

由于您不需要此脚本,因为您已经在上面的代码中自己执行此操作,您可以删除此脚本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 2016-01-29
    • 1970-01-01
    • 2013-07-16
    • 2015-10-21
    相关资源
    最近更新 更多