我正在尝试实现 Jquery 飞涨 在我的 Joomla 驱动网站上的目录图像上。我无法让这个东西工作,所以有人可以帮我解决这个问题吗?

我在头部添加了这些脚本:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js" type="text/javascript"></script>
<script src="http://www.myurl.mk/templates/beez_20/javascript/jquery.zoom.js"></script>

这是它给出的错误:

Uncaught TypeError: Object #<HTMLDocument> has no method 'ready'
(anonymous function)

这是我网站示例的链接

这是我的代码:

<script>
        $(document).ready(function(){
            $('#ex1').zoom({url: '<?php echo $this->item->imageXLarge; ?>'});
        });
    </script>
      <div class="itemImageBlock" style="float:none;">
          <span class="itemImage" id="ex1">
                <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
          </span>
有帮助吗?

解决方案

我看到你的页面,发现你正在加载依赖文件之后的 jQuery 文件。控制台有很多错误。第一个是 jQuery 未定义。将 jQuery 文件移到所有其他脚本文件之前。

将 jQuery 移至顶部后,您的网站看起来不错。我按照您的要求附上了一张快照。enter image description here

其他提示

在您的示例页面上,您将在 jquery.js 之前导入 ks2.js。

这应该是您之后的第一项 <head> 标签:

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top