Flip JQuery 插件不工作

发布于 2025-01-05 00:22:51 字数 317 浏览 0 评论 0原文

我正在为一个项目制作一个网站,我发现并决定使用 jquery Flip 插件 ,而且它不起作用...我不久前确实设法让它工作,但从那以后就不能了。请记住,我还没有制作网站的图形部分,所以那里的内容仅供展示。

这是该网站的源代码。

没有错误,只是不起作用(翻转所述框)。正如我所说,它以前可以工作,但是当我添加其他盒子时,它就停止工作了。

I'm making a website for a project, and I discovered and decided to use the, jquery flip plugin, and it's not working... I did manage to get it working a while ago, but couldn't since. Bear in mind I have not yet made the grafic part of the website yet, so what's there is just for show.

Here's the source code for the website.

No errors, just not working (fliping said boxes). As I said, it worked before, but when I added those other boxes, it stopped working.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不必你懂 2025-01-12 00:22:51

在 Flip 插件之前包含 jQuery UI。由于 Flip 插件需要 jQuery UI 才能使用,如果不可用,它可能会失败。

使用插件文档网站上的演示作为模板总是一个好主意。 Flip 插件按以下顺序包含 JS 文件:

    <script src="/lab/flip/js/jquery-ui-1.7.2.custom.min.js"></script>
    <script src="/lab/flip/js/jquery.flip.min.js"></script>

此外,在 JSFIddle 中,您必须使用资源的绝对 URL,JSFiddle 不会神奇地找到 jquery/jquery.flip.min.js

这是 JSFiddle 的更新版本,我从插件的文档中获取了上述文件:http://jsfiddle。 net/mNQJB/2/

如果上述方法未能解决您的问题,则您的代码存在错误,.flip 调用之一包含无效的内容 财产:

未捕获的语法错误:意外的标记。

确保您的 content 属性全部位于一行,或者您已正确转义结束行字符。

更新

为了转义 JS 中的结束行字符,我们这样做:

var str = "This is a string and \
I want it to use two lines.";

注意反斜杠,它是标准的转义字符。现在,如果您想创建一个通过 HTML 呈现的新行,那么您应该使用
标记:

var str = "This is a string and <br />I want it to use two lines.";

Include jQuery UI before the Flip plugin. Since the Flip plugin needs jQuery UI to be available it probably fails when it's not.

It's always a good idea to use the demos on the plugin's documentation website as a template. The flip plugin includes the JS files in this order:

    <script src="/lab/flip/js/jquery-ui-1.7.2.custom.min.js"></script>
    <script src="/lab/flip/js/jquery.flip.min.js"></script>

Also, in your JSFIddle, you have to use absolute URLs for the resources, JSFiddle doesn't magically find jquery/jquery.flip.min.js.

Here is an updated version of your JSFiddle, I grabbed the above files from the plugin's documentation: http://jsfiddle.net/mNQJB/2/

If the above didn't fix your problem, there was an error with your code, one of the .flip calls had an invalid content property:

Uncaught SyntaxError: Unexpected token .

Make sure that your content properties are all on a single line or you have escaped the end-line characters properly.

Update

To escape an end-line character in JS we do this:

var str = "This is a string and \
I want it to use two lines.";

Notice the backslash, it's the standard escaping character. Now if you want to create a new line that will be rendered via HTML then you should use a <br /> tag:

var str = "This is a string and <br />I want it to use two lines.";
一念一轮回 2025-01-12 00:22:51
you have an unterminated string constant in this section:

 $("#aimsb").bind("click",function(){
        $("#aims").flip({
            direction: 'bt',
            color: '#39AB3E',
            content: 'The aims of the GSP (Global Student Project) are to give students from all around the world both a culturally and personally enriching experience, as well as equal learning, and subsquently job opportunities
            .'
        });
    });

请注意 .' 之前的换行符

you have an unterminated string constant in this section:

 $("#aimsb").bind("click",function(){
        $("#aims").flip({
            direction: 'bt',
            color: '#39AB3E',
            content: 'The aims of the GSP (Global Student Project) are to give students from all around the world both a culturally and personally enriching experience, as well as equal learning, and subsquently job opportunities
            .'
        });
    });

note the line feed prior to the .'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文