Javascript - 计划滚动问题

时间:2013-09-21 07:46:28

标签: javascript jquery html

我目前正在制作日历。我在制作压光容器滚动时遇到困难。 javascript在计划日期容器中生成日期,其中包含所有日期。它还可以生成一个全尺寸的日历,它可以在里面显示各种物体。我遇到的问题是我正在尝试让滚动工作。当我点击日程安排日期容器中的数字时,它会将完整大小的日历滚动到该特定日期,但是我在编辑滚动部分时遇到了困难。感谢您的帮助。

<p>
<div id='schedule-date-background'>
<div id='schedule-date-container'>
</div>
</div>
<div id="schedule-overall-frame">
<div id='schedule-overall-container'>
</div>
</div>
</p>

// JavaScript Document $(document).ready(function(){

//Global Variables
var week = [14,15,16,17,18,19,20,21,22,23,24,25,26,27];
var today = new Date();
var day = today.getDate();
//End of Global Variable

//Dates loaders
function LoadDates()
{ 
    for (var i = 0; i < week.length; i++)
        {
                            //add <div id="today"> to the schedule 
            if (day==week[i]){
                var ObjDiv = $('<div></div>');
                ObjDiv.addClass(i);
                ObjDiv.addClass("schedule-date-minicontainer");
                ObjDiv.addClass("today");
                ObjDiv.append(week[i]);
                $('#schedule-date-container').append(ObjDiv);
            }
                            //generate dates
            else{
                var ObjDiv = $('<div></div>');
                ObjDiv.addClass(i);
                ObjDiv.addClass("schedule-date-minicontainer");
                ObjDiv.append(week[i]);
                $('#schedule-date-container').append(ObjDiv);
            }
    }     

    var container = 0;

    for (var i=0; i<week.length; i++)
    {  

        var ObjDiv = $('<div></div>');
        ObjDiv.addClass("schedule-stripcontainer");
        ObjDiv.append(week[i]);
        $('#schedule-overall-container').append(ObjDiv);
        if (day==week[i]){
            container = "230" * (i-1);

        }

    }

    /*document.getElementById("schedule-overall-container").style.marginLeft = -container + "px" ;*/
    $('div#schedule-overall-container').animate({'left': -container}, 'slow')



} 
  //End of Dates Loader


    $(document).ready(function () {
        document.getElementsByClassName('0').click(function () {
        document.getElementsByClassName('0').animate({'left': '+=230px'}, 'slow');
        $('div#schedule-overall-container').animate({'left': '+=230px'}, 'slow');

    });


    $('.1').click(function () {
        document.getElementsByClassName.animate({'left': '+=230px'}, 'slow');
        $('div#schedule-overall-container').animate({'left': '+=230px'}, 'slow');
    });  

0 个答案:

没有答案