Javascript 如何创建HTML+;jScript滚动触发框

Javascript 如何创建HTML+;jScript滚动触发框,javascript,html,blogger,Javascript,Html,Blogger,我在Blogger.com上有一个博客,我想添加一个滚动触发框,比如Dreamgrow或Wordpress的Qoate滚动触发框。我提到过。我已经创建了一个HTML文件并对其进行了测试,但这对我来说不起作用。可能是我弄错了什么地方。我的编码是 <html> <head> <title>Scroll Triggered Box With jQuery</title> <style type="text/css"> .Comments

我在Blogger.com上有一个博客,我想添加一个滚动触发框,比如Dreamgrow或Wordpress的Qoate滚动触发框。我提到过。我已经创建了一个HTML文件并对其进行了测试,但这对我来说不起作用。可能是我弄错了什么地方。我的编码是

<html>

<head>

<title>Scroll Triggered Box With jQuery</title>

<style type="text/css">
.Comments
{
font:georgia;
display:none;
}


</style>

</head>

<body>

<script type="text/javascript">
    $(document).ready(function () {
        $(window).scroll(function () {
            var y = $(window).scrollTop();
            var c = $('#comments').offset();
            if (y > (c.top - $(window).height())) {
                $('#the_box').fadeIn("slow");
            } else {
                $('#the_box').fadeOut('slow');
            }
        });
    });
</script>

<div>
<!--My long post here-->
</div>

<div class="Comments" id="the_box">
This is the DIV that triggers I scroll down to Comments</br>
This is the DIV that triggers I scroll down to Comments</br>
This is the DIV that triggers I scroll down to Comments</br>
This is the DIV that triggers I scroll down to Comments</br>
This is the DIV that triggers I scroll down to Comments</br>
This is the DIV that triggers I scroll down to Comments
</div>

</body>

</html>

使用jQuery滚动触发框
.评论
{
字体:格鲁吉亚;
显示:无;
}
$(文档).ready(函数(){
$(窗口)。滚动(函数(){
变量y=$(窗口).scrollTop();
var c=$(“#注释”).offset();
如果(y>(c.top-$(window.height()){
$(“#the#u box”).fadeIn(“慢”);
}否则{
$('the#u box')。淡出('slow');
}
});
});
这是触发我向下滚动到评论的DIV
这是触发我向下滚动到评论的DIV
这是触发我向下滚动到评论的DIV
这是触发我向下滚动到评论的DIV
这是触发我向下滚动到评论的DIV
这是触发我向下滚动到评论的DIV
我在jScript方面有点弱。我不知道jScript是如何工作的


我如何解决我的问题,并在我的Blogger.com博客中实现这一点?

我可以告诉你,你的代码乱七八糟

  var a =$(window).height();
  var num = c-y;
 if (y > num){
   do your function
    }else{
  do whatever
    }

没有得到haywire的东西……我不知道jScript。你能提供给我现成的代码和步骤如何使用它或教程,我可以学习这个主题?PLZ我编写的代码只需添加其余变量并将它们包装在脚本标记中。在客户端的滚动高度大于div的偏移量(窗口高度)之前,我发布的内容不会显示框。事实上,我现在正在工作,过几天回到家后,我会把它放在演示页面上。它的作品只是上下滚动,请接受我的回答,谢谢