简体   繁体   English

“ Gridder Ajax”插件的问题

[英]Issue with “Gridder Ajax” plug-in

I want to add the Gridder Ajax jquery plugin to my portfolio site in order to showcase my work. 我想将Gridder Ajax jquery插件添加到我的投资组合站点,以展示我的工作。 I followed the Readme file on the Github site ( https://github.com/oriongunning/gridder-ajax ) and copied the code exactly. 我遵循了Github网站( https://github.com/oriongunning/gridder-ajax )上的自述文件,并精确地复制了代码。 I have also downloaded the plugin files and have pointed the plugin's JS script and CSS link to the correct directory path in the head of my html document as you can see in my code below. 我还下载了插件文件,并将插件的JS脚本和CSS链接指向html文档开头的正确目录路径,如下面的代码所示。 I have tried moving the JQuery code from the head to the bottom of the body in my document as well but that did not work. 我也尝试过将JQuery代码从文档的头部移动到正文的底部,但这没有用。 I also created a Jquery alert() to make sure that JQuery is actually running and it worked just fine. 我还创建了一个Jquery alert()来确保JQuery实际上正在运行并且工作正常。 It seems like the JQuery code is not working but the CSS is. 似乎JQuery代码无法正常工作,但CSS可以正常工作。 The reason I say this is because if I comment out the CSS plugin tag in the , then a unordered list bullet shows up next to the image. 我之所以这样说是因为,如果我在中注释掉CSS插件标签,那么图像旁边会显示一个无序的列表项目符号。 When I uncomment the code the bullet disappears. 当我取消注释代码时,项目符号消失。 So I guess some styling is being applied. 所以我猜想正在应用一些样式。 I think I am not calling the plugin's JS file correctly because I am expecting an image to render that I can click and then it should expand with a description and link. 我认为我没有正确调用该插件的JS文件,因为我希望可以渲染一个可以单击的图像,然后应使用说明和链接对其进行扩展。

Here is the link to my editor: https://ide.c9.io/dfmmalaw/scrollmagic-parallax 这是我的编辑器的链接: https : //ide.c9.io/dfmmalaw/scrollmagic-parallax

Here is the link to the site: https://scrollmagic-parallax-dfmmalaw.c9users.io 这是该站点的链接: https : //scrollmagic-parallax-dfmmalaw.c9users.io

Here is the link to the files: https://preview.c9users.io/dfmmalaw/scrollmagic-parallax 这是文件的链接: https : //preview.c9users.io/dfmmalaw/scrollmagic-parallax

I also created this JSfiddle to show you how my code looks and what is actually rendering. 我还创建了此JSfiddle,以向您展示我的代码外观以及实际呈现的内容。 https://jsfiddle.net/dfmmalaw/ossjtn33/ Obviously JSfiddle cannot use the css and js files since they are not hosted remotely by the plugin author but you can at least get an idea of how my code is structured. https://jsfiddle.net/dfmmalaw/ossjtn33/显然,JSfiddle无法使用css和js文件,因为它们不是由插件作者远程托管的,但是您至少可以了解我的代码的结构。 Can someone tell me why this is not working? 有人可以告诉我为什么这不起作用吗?

Code in head: 头中的代码:

<link href="css/gridder-ajax.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
<script src="js/gridder-ajax.js"></script>

<script>
    jQuery(document).ready(function ($) {

        // Call Gridder Ajax with
        // default options

        $('.gridder-list').GridderAjax({
            scrollOffset: 0,
            rootUrl: "/",
            animationSpeed: 600,
            animationEasing: "easeInOutExpo"
        });
    });
</script>

Code in body: 正文中的代码:

<div class="gridder-list">
  <li class="item  item_1">
    <a href="item_4" title="Item 4" class="link">
      <img src="http://lorempixel.com/300/200/food/?date=6">
      <span class="title">Item 4</span>
      <span class="description">A small Description</span>
    </a>
    <span class="selectedBox"></span>
  </li>
</div>

I'm not quite sure what is wrong as you've not really giving me enough information to help you. 我不太确定出什么问题了,因为您没有真正给我足够的信息来帮助您。 The ajax version is a little complex and usually needs to be tweaked for each usage. Ajax版本有点复杂,通常需要针对每种用法进行调整。

Do you have a test link/image so I can view what's wrong? 您是否有测试链接/图像,以便我查看问题所在?

In all cases, study the demo and the github page and you should eventually manage. 在所有情况下,请研究演示和github页面,您最终应该进行管理。

http://www.oriongunning.com/demo/gridder-ajax/demo.php http://www.oriongunning.com/demo/gridder-ajax/demo.php

EDIT 编辑

Do no use the minified version and make sure all classes are correctly setup (the click was registered to the .do-expand-item which was inexistant in the markup.).The code is pretty well documented so it should not be too hard. 不要使用缩小版本,并确保所有类均已正确设置(单击已注册到标记中不存在的.do-expand-item中。)代码已被很好地记录,因此应该不太难。 I've added a jsfiddle below. 我在下面添加了一个jsfiddle。

Regards, Orion 问候,猎户座

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM