wordpress jquery滑块不工作

wordpress jquery滑块不工作,jquery,wordpress,Jquery,Wordpress,在我的主页中添加了滚动条/滑块。当我在它自己的页面上构建它时,它是工作的,但当复制到Wordpress时,它并没有动画/滚动。不知道问题是什么 以下是css: /* js-disabled class - set image sizes so they all fit in the viewer */ .js-disabled img { width:100px; height:100px; display:block; float:left; margin:30px 0 0; } #out

在我的主页中添加了滚动条/滑块。当我在它自己的页面上构建它时,它是工作的,但当复制到Wordpress时,它并没有动画/滚动。不知道问题是什么

以下是css:

/* js-disabled class - set image sizes so they all fit in the viewer */
.js-disabled img { width:100px; height:100px; display:block; float:left; margin:30px 0 0; }

#outerContainer { width:642px; height:202px; margin:auto; position:relative; }
#imageScroller { width:642px; height:202px; position:absolute; left: 10px; top: 567px;      background:#000000 url(../images/imageScrollerBG.png) no-repeat; }
#viewer { width:622px; height:182px; overflow:hidden; margin:auto; position:absolute; top:10px; }
#imageScroller a:active, #imageScroller a:visited { color:#000000; }
#imageScroller a img { border:0; }
#controls { width:634px; height:47px; background:url
(../images/controlsBG.png) no-repeat; position:absolute; top:4px;
left:4px; z-index:10;}
#controls a { width:37px; height:35px; position:absolute; top:3px; }
#controls a:active, #controls a:visited { color:#0d0d0d; }
#title { color:#ffffff; font-family:arial; font-size:100%;
font-weight:bold; width:100%;text-align:center; margin-top:10px; }
#rtl { background:url(../images/rtl.png) no-repeat; left:100px; }
#rtl:hover { background:url(../images/rtl_over.png) no-repeat; left:99px; }
#ltr { background:url(../images/ltr.png) no-repeat; right:100px; }
#ltr:hover { background:url(../images/ltr_over.png) no-repeat; }
以及html:

<div id="outerContainer">
            <div id="imageScroller">
                <div id="viewer" class="js-disabled">
<a class="wrapper" href="hhttp://aerodynamicmusic.com/wordpress/portfolio/sxsw-march-12/" title="SXSW March 12, 2012"><img class="logo" id="sxsw12" src="http://aerodynamicmusic.com/wordpress/wp-content/uploads/2012/05/sxsw12_slider.jpg" alt="SXSW March 12, 2012"></a><a class="wrapper" href="http://aerodynamicmusic.com/wordpress/portfolio/sxsw-march-14/" title="SXSW March 14, 2012"><img class="logo" id="sxsw14" src="http://aerodynamicmusic.com/wordpress/wp-content/uploads/2012/05/sxsw14_slider.jpg" alt="SXSW March 14, 2012"></a><a class="wrapper" href="http://aerodynamicmusic.com/wordpress/portfolio/sxsw-march-16/" title="SXSW March 16, 2012"><img class="logo" id="sxsw16" src="http://aerodynamicmusic.com/wordpress/wp-content/uploads/2012/05/sxsw16_slider.jpg" alt="SXSW March 16, 2012"></a><a class="wrapper" href="http://aerodynamicmusic.com/wordpress/portfolio/sxsw-march-17/" title="SXSW March 17, 2012"><img class="logo" id="sxsw17" src="http://aerodynamicmusic.com/wordpress/wp-content/uploads/2012/05/sxsw17_slider.jpg" alt="SXSW March 17, 2012"></a><a class="wrapper" href="http://aerodynamicmusic.com/wordpress/portfolio/sxsw-march-18/" title="SXSW March 18, 2012"><img class="logo" id="sxsw18" src="http://aerodynamicmusic.com/wordpress/wp-content/uploads/2012/05/sxsw18_slider.jpg" alt="SXSW March 18, 2012"></a><a class="wrapper" href="http://aerodynamicmusic.com/wordpress/portfolio/releases1/" title="Men at Work"><img class="logo" id="menatwork" src="http://aerodynamicmusic.com/wordpress/wp-content/uploads/2012/05/men_slider.jpg" alt="Men at Work"></a>
            </div>
                </div>
        </div>


        <script type="text/javascript">
            jQuery(function() {

              //remove js-disabled class
                jQuery("#viewer").removeClass("js-disabled");

              //create new container for images
                jQuery("<div>").attr("id", "container").css({ position:"absolute"}).width(jQuery(".wrapper").length * 170).height(170).appendTo("div#viewer");

                //add images to container
                jQuery(".wrapper").each(function() {
                    jQuery(this).appendTo("div#container");
                });

                //work out duration of anim based on number of images (1 second for each image)
                var duration = jQuery(".wrapper").length * 2000;

                //store speed for later (distance / time)
                var speed = (parseInt(jQuery("div#container").width()) + parseInt(jQuery("div#viewer").width())) / duration;

                //set direction
                var direction = "rtl";

                //set initial position and class based on direction
                (direction == "rtl") ? jQuery("div#container").css("left", jQuery("div#viewer").width()).addClass("rtl") : jQuery("div#container").css("left", 0 - jQuery("div#container").width()).addClass("ltr") ;

                //animator function
                var animator = function(el, time, dir) {

                    //which direction to scroll
                    if(dir == "rtl") {

                      //add direction class
                        el.removeClass("ltr").addClass("rtl");

                        //animate the el
                        el.animate({ left:"-" + el.width() + "px" }, time, "linear", function() {

                            //reset container position
                            jQuery(this).css({ left:jQuery("div#imageScroller").width(), right:"" });

                            //restart animation
                            animator(jQuery(this), duration, "rtl");

                            //hide controls if visible
                            (jQuery("div#controls").length > 0) ? jQuery("div#controls").slideUp("slow").remove() : null ;          

                        });
                    } else {

                      //add direction class
                        el.removeClass("rtl").addClass("ltr");

                        //animate the el
                        el.animate({ left:jQuery("div#viewer").width() + "px" }, time, "linear", function() {

                            //reset container position
                            jQuery(this).css({ left:0 - jQuery("div#container").width() });

                            //restart animation
                            animator(jQuery(this), duration, "ltr");

                            //hide controls if visible
                            (jQuery("div#controls").length > 0) ? jQuery("div#controls").slideUp("slow").remove() : null ;          
                        });
                    }
                }

                //start anim
                animator(jQuery("div#container"), duration, direction);

                //pause on mouseover
                jQuery("a.wrapper").live("mouseover", function() {

                    //stop anim
                    jQuery("div#container").stop(true);

                    //show controls
                    (jQuery("div#controls").length == 0) ? jQuery("<div>").attr("id", "controls").appendTo("div#outerContainer").css({ opacity:0.7 }).slideDown("slow") : null ;
                    (jQuery("a#rtl").length == 0) ? jQuery("<a>").attr({ id:"rtl", href:"#", title:"rtl" }).appendTo("#controls") : null ;
                    (jQuery("a#ltr").length == 0) ? jQuery("<a>").attr({ id:"ltr", href:"#", title:"ltr" }).appendTo("#controls") : null ;

                    //variable to hold trigger element
                    var title = jQuery(this).attr("title");

                    //add p if doesn't exist, update it if it does
                    (jQuery("p#title").length == 0) ? jQuery("<p>").attr("id", "title").text(title).appendTo("div#controls") : jQuery("p#title").text(title) ;
                });

                //restart on mouseout
                jQuery("a.wrapper").live("mouseout", function(e) {

                    //hide controls if not hovering on them
                    (e.relatedTarget == null) ? null : (e.relatedTarget.id != "controls") ? jQuery("div#controls").slideUp("slow").remove() : null ;

                    //work out total travel distance
                    var totalDistance = parseInt(jQuery("div#container").width()) + parseInt(jQuery("div#viewer").width());

                    //work out distance left to travel
                    var distanceLeft = (jQuery("div#container").hasClass("ltr")) ? totalDistance - (parseInt(jQuery("div#container").css("left")) + parseInt(jQuery("div#container").width())) : totalDistance - (parseInt(jQuery("div#viewer").width()) - (parseInt(jQuery("div#container").css("left")))) ;

                    //new duration is distance left / speed)
                    var newDuration = distanceLeft / speed;

                    //restart anim
                    animator(jQuery("div#container"), newDuration, jQuery("div#container").attr("class"));

                });

                //handler for ltr button
                jQuery("#ltr").live("click", function() {

                    //stop anim
                    jQuery("div#container").stop(true);

                    //swap class names
                    jQuery("div#container").removeClass("rtl").addClass("ltr");

                    //work out total travel distance
                    var totalDistance = parseInt(jQuery("div#container").width()) + parseInt(jQuery("div#viewer").width());

                    //work out remaining distance
                    var distanceLeft = totalDistance - (parseInt(jQuery("div#container").css("left")) + parseInt(jQuery("div#container").width()));

                    //new duration is distance left / speed)
                    var newDuration = distanceLeft / speed;

                //restart anim
                animator(jQuery("div#container"), newDuration, "ltr");
            });

            //handler for rtl button
            jQuery("#rtl").live("click", function() {

                //stop anim
                jQuery("div#container").stop(true);

                //swap class names
                jQuery("div#container").removeClass("ltr").addClass("rtl");

                //work out total travel distance
                var totalDistance = parseInt(jQuery("div#container").width()) + parseInt(jQuery("div#viewer").width());

                //work out remaining distance
                var distanceLeft = totalDistance - (parseInt(jQuery("div#viewer").width()) - (parseInt(jQuery("div#container").css("left"))));

                //new duration is distance left / speed)
                var newDuration = distanceLeft / speed;

                //restart anim
                animator(jQuery("div#container"), newDuration, "rtl");
            });
        });
    </script>

jQuery(函数(){
//删除js禁用类
jQuery(“#查看器”).removeClass(“js禁用”);
//为图像创建新容器
jQuery(“”.attr(“id”,“container”).css({position:“absolute”}).width(jQuery(“.wrapper”).length*170).height(170).appendTo(“div#viewer”);
//将图像添加到容器
jQuery(“.wrapper”).each(函数(){
jQuery(this).appendTo(“div#container”);
});
//根据图像数量计算动画的持续时间(每幅图像1秒)
var duration=jQuery(“.wrapper”)。长度*2000;
//存储以后的速度(距离/时间)
var speed=(parseInt(jQuery(“div#container”).width())+parseInt(jQuery(“div#viewer”).width())/duration;
//设定方向
var direction=“rtl”;
//根据方向设置初始位置和类别
(direction==“rtl”)?jQuery(“div#container”).css(“left”,jQuery(“div#viewer”).width()).addClass(“rtl”):jQuery(“div#container”).css(“left”,0-jQuery(“div#container”).width()).addClass(“ltr”);
//动画师函数
var animator=函数(el、时间、方向){
//滚动哪个方向
如果(dir==“rtl”){
//添加方向类
el.removeClass(“ltr”).addClass(“rtl”);
//为el设置动画
el.animate({左:“-”+el.width()+“px”},时间,“线性”,函数(){
//重置集装箱位置
jQuery(this).css({左:jQuery(“div#imageScroller”).width(),右:“});
//重新启动动画
动画师(jQuery(this),持续时间,“rtl”);
//隐藏控件(如果可见)
(jQuery(“div#controls”).length>0)?jQuery(“div#controls”).slideUp(“slow”).remove():null;
});
}否则{
//添加方向类
el.removeClass(“rtl”).addClass(“ltr”);
//为el设置动画
动画({left:jQuery(“div#viewer”).width()+“px”},时间,“线性”,函数(){
//重置集装箱位置
css({left:0-jQuery(“div#container”).width()});
//重新启动动画
动画师(jQuery(this),持续时间,“ltr”);
//隐藏控件(如果可见)
(jQuery(“div#controls”).length>0)?jQuery(“div#controls”).slideUp(“slow”).remove():null;
});
}
}
//开始动画
动画师(jQuery(“div#container”)、持续时间、方向;
//鼠标悬停
jQuery(“a.wrapper”).live(“mouseover”,function(){
//停止动画
jQuery(“div#container”).stop(true);
//显示控件
(jQuery(“div#controls”).length==0)?jQuery(“”.attr(“id”,“controls”).appendTo(“div#outerContainer”).css({opacity:0.7})。slideDown(“slow”):null;
(jQuery(“a#rtl”).length==0)?jQuery(“”)attr({id:“rtl”,href:“#”,title:“rtl”})。附录(“#控件”):null;
(jQuery(“a#ltr”).length==0)?jQuery(“”)attr({id:“ltr”,href:“#”,title:“ltr”})。附录(“#控件”):null;
//用于保存触发器元素的变量
var title=jQuery(this).attr(“title”);
//如果p不存在,则添加p;如果存在,则更新p
(jQuery(“p#title”).length==0)?jQuery(“p>”).attr(“id”,“title”).text(title)。appendTo(“div#controls”):jQuery(“p#title”).text(title);
});
//在鼠标上重新启动
jQuery(“a.wrapper”).live(“mouseout”,函数(e){
//如果控件未悬停在其上,则隐藏控件
(e.relatedTarget==null)?null:(e.relatedTarget.id!=“控件”)?jQuery(“div#controls”).slideUp(“slow”).remove():null;
//算出总旅行距离
var totalDistance=parseInt(jQuery(“div#container”).width())+parseInt(jQuery(“div#viewer”).width());
//计算出要行驶的距离
var distanceLeft=(jQuery(“div#container”).hasClass(“ltr”))?totalDistance-(parseInt(jQuery(“div#container”).css(“left”)+parseInt(jQuery(“div#container”).width()):totalDistance-(parseInt(jQuery(“div##container”).width())-(parseInt(jQuery(“div##container”).css(“left”)))));
//新的持续时间为左距离/速度)
var newDuration=距离左/速度;
//重新启动动画
animator(jQuery(“div#container”)、newDuration、jQuery(“div#container”).attr(“class”);
});
//ltr按钮的处理程序
jQuery(“#ltr”).live(“单击”,函数(){
//停止动画
jQuery(“div#container”).stop(true);
//交换类名
jQuery(“div#container”).removeClass(“rtl”).addClass(“ltr”);
//算出总旅行距离
VaRealTealStase= PARSETIN(jQuery(“DIV.*容器”).WITH())