jScrollPane 错误?页面刷新破坏了 jScrollPane 或其他因素影响了它

发布于 2024-09-08 17:29:16 字数 1356 浏览 6 评论 0原文

我注意到这个问题主要出现在 OS 10.5.8 上的 Firefox 3.6.6 上,Safari 上偶尔也会出现这个问题(准备好你惊讶的表情 - IE 实际上每次都工作正常 - 什么?!)。

我的网址在这里: http://culturewithinaculture.org/introduction.php

注意:由于我们尚未正式启动该网站,因此该网站目前受密码保护。
用户:cwac
通过:cwac2112

问题:如果您访问上面的链接,第一次应该可以正常加载。 JS 和 CSS 文件看起来一切都很好。但是,当您点击刷新时,它就会崩溃。有时需要刷新 1 次,有时需要 2 或 3 次。另一个奇怪的事情是,如果您等待 30 秒左右并点击刷新,就会再次正常。看起来相当随机。当我说它“中断”时,我的意思是它无法将 jScrollPane 函数应用于我的英语和日语副本的 DIV 标签。

所以我尝试在不同时间加载所需的 JS 文件,但还没有成功。例如,尝试在 jScrollPane.js 文件之前和之后加载 mousewheel.js 文件。我还使用了 Google 托管版本的 Jquery 链接,认为它可能向我们的 MediaTemple 托管帐户请求太多...可能是缓存问题等。这是我用来加载所有必要的代码页面的功能(主要使用jScrollPane和prettyPhoto作为视频链接):

$(document).ready(function(){

// scrollpane code

    $('.scroll-pane').jScrollPane();    

//Rollovers for navigation buttons

    $(".navBtn").hover(
        function(){
            this.src = this.src.replace("_org","_over");
        },
        function(){
            this.src = this.src.replace("_over","_org");
    });


//PrettyPhoto Function
$(function()
    {
    $("a[rel^='prettyPhoto']").prettyPhoto();
    });
});

如果你们有任何建议,我将不胜感激。我绝对是 jQuery 的新手,这是我的第一个仅使用 jQuery 的网站。有人以前使用 jScrollPane 时遇到过此错误吗?我的 CSS 有什么奇怪的东西破坏了这个吗?

I notice the problem mostly with Firefox 3.6.6 on OS 10.5.8, and it happens occasionally with Safari (get your surprised face ready - IE actually works fine everytime - what?!).

My url is here:
http://culturewithinaculture.org/introduction.php

NOTE: It's password protected for now, as we haven't officially launched the site.

User: cwac
pass: cwac2112

Problem: If you visit the link above it should load fine the first time. Everything seems fine with the JS and CSS files. HOWEVER, when you hit refresh it breaks. Sometimes it takes 1 refresh, other times it takes 2 or 3. The other odd thing is that if you wait 30 seconds or so and hit refresh it will be fine again. Seems fairly random. When I say it 'breaks' I mean it fails to apply the jScrollPane function to the DIV tags I have for the English and Japanese copy.

So I've tried loading the required JS files at different times with no luck yet. For example tried loading the mousewheel.js file before and after the jScrollPane.js file. I'm also using a link to the Google hosted version of Jquery, thinking that it could be requesting too much from our MediaTemple hosted account...perhaps a caching issue etc. Here is the code I'm using to load all the necessary functions for the page (mainly using jScrollPane, and prettyPhoto for the video links):

$(document).ready(function(){

// scrollpane code

    $('.scroll-pane').jScrollPane();    

//Rollovers for navigation buttons

    $(".navBtn").hover(
        function(){
            this.src = this.src.replace("_org","_over");
        },
        function(){
            this.src = this.src.replace("_over","_org");
    });


//PrettyPhoto Function
$(function()
    {
    $("a[rel^='prettyPhoto']").prettyPhoto();
    });
});

If you guys have any suggestions, I'd greatly appreciate it. I am definitely a newbie with jQuery, and this is my first site using only jQuery. Anyone had this error with jScrollPane before? Is there something funky about my CSS that is breaking this?

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

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

发布评论

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

评论(2

夕嗳→ 2024-09-15 17:29:17

这有点盲目,但请尝试在 js 文件之前加载 CSS 文件。

我似乎记得在某处读过,你的 CSS 应该在 jQuery 代码之前定义。 我正在寻找该文档。如果我找到它,我会发布它。

更新:

它来自 Jonathan Chaffer、Karl Swedberg 的学习 jQuery 1.3

为了确保页面在 JavaScript 代码执行之前也已设置样式,最好将 标记放在 < script> 文档的 元素中的标记。

This is a bit of a shot in the dark, but try loading your CSS files before your js files.

I seem to remember reading somewhere that your CSS should be defined before jQuery code. I'm searching for that document. Will post it if I find it.

Update:

It came from Learning jQuery 1.3 by Jonathan Chaffer, Karl Swedberg

To ensure that the page has also been styled before the JavaScript code executes, it is a good practice to place <link rel="stylesheet"> tags prior to <script> tags within the document's <head> element.

幻梦 2024-09-15 17:29:17

我同意帕特里克的观点,过去半个小时我一直在测试你的页面,但没有结果。
CSS 应该有问题,我仍然不明白它如何在重新加载页面之前第一次正常工作并在重新加载后崩溃

I Agree with patrick, I have been testing your page for the past half an hour, yet no result.
There should be some thing wrong with CSS, I still don't understand How it worked fine for first time before reloading the page and crashing after reloading

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