简体   繁体   English

jQuery autoscroll插件未触发

[英]jquery autoscroll plugin not firing

I am sure my issue is a result of my inexperience in jquery and javascript. 我确定我的问题是由于我对jquery和javascript的经验不足造成的。 I am trying to use an autoscroll jquery plugin. 我正在尝试使用自动滚动jquery插件。 I just stares at me when I click the link that is supposed to activate the scroll. 当我单击应该激活滚动的链接时,我只是凝视着我。 Can someone help? 有人可以帮忙吗? Here is what I have: 这是我所拥有的:
I have called the relevant scripts in the head tag. 我已经在head标签中调用了相关脚本。
In at the end of my body tag I have this: 在我的身体标签的末尾,我有这个:

<script type="text/javascript">
$(document).ready(function() {
$("a.hello").click(function () {
    $("#text").autoscroll("toggle", { 
        start: { 
            step: 50, 
            scroll: true, 
            direction: "down", 
            pauseOnHover: true 
        }, 
        delay: 5000, 
        ffrw: { 
            speed: "fast", 
            step: 100 
        } 
    });
});
});
</script>

Then, I am trying to fire the script using an anchor, like this: 然后,我尝试使用锚点触发脚本,如下所示:

<a href="#" class="hello">start/stop</a>

The id of the div that I want to 'pause on hover' is "text". 我要“悬停时暂停”的div的ID为“文本”。
The source and instructions of this plugin is found here . 源和这个插件的指示找到这里 Thanks. 谢谢。

EDIT: 编辑:
The function that calls some html from other files based on form selects and puts it into the <div id="text"></div> . 该函数会根据表单从其他文件中调用一些html并将其放入<div id="text"></div>

function clickMe() {
    var book = document.getElementById("book").value;
    var chapter = document.getElementById("chapter").value;
    var myFile = "'files/" + book + chapter + ".html'";
    $('#text').load(myFile + '#source')
}

You forgot to wrap the code inside a 您忘了将代码包装在

$(document).ready(function() {
..
});

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

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