图像不断移动

时间:2012-11-13 05:15:36

标签: javascript wordpress

我的主题是主页上有一个滑块,上一页和下一页的图像一直在上下移动。

如何重现: 转到my site上的页面。 点击标题徽标即可进入主页。 命中f5。这是左右漩涡应该是的地方。

主题创建者尚未回复,也没有任何论坛可以提供帮助。你能告诉我应该对此做些什么修改:

<script type="text/javascript">
stepcarousel.setup({
galleryid: 'mygallery', //id of carousel DIV
beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
panelclass: 'panel', //class of panel DIVs each holding content
panelbehavior: {speed:400, wraparound:true, persist:true},
defaultbuttons: {enable: true, moveby: 3, leftnav: ['<?php bloginfo('template_directory'); ?>/images/prev.png', -90, 120], rightnav: ['<?php bloginfo('template_directory'); ?>/images/next.png', 15, 120]},
statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
contenttype: ['external'] //content setting ['inline'] or ['external', 'path_to_external_file']
 })

</script>

我可以用css做点什么来修复这个位置吗?

#mygallery{ padding:0;position: relative;}

.stepcarousel{
position: relative; /*leave this value alone*/
overflow: scroll; /*leave this value alone*/
width: 980px; /*Width of Carousel Viewer itself*/
height:300px; /*Height should enough to fit largest content's height*/
margin:0 auto;
padding:0;
}

.stepcarousel .belt{
position: absolute; /*leave this value alone*/
left: 0;
top: 0px;
}

 .stepcarousel .panel{
float: left; /*leave this value alone*/
overflow: hidden; /*clip content that go outside dimensions of holding panel DIV*/
margin:0 40px 0 0;
border:none;
  }


 .thumb-title{
top:-105px;
right:0;
display:block;
position:absolute;
width: 250px; height:68px;
background: #eee url(images/line-h-l.png) top repeat-x;
margin:0;
overflow:hidden;
text-shadow:0 1px 1px #333;
}   



 .thumb-title-clear{
padding:10px 20px 10px 20px;
height:48px;
overflow:hidden;
}

 .thumb-title h2 a {
display:block;
text-decoration: none;
font-size:16pt;
line-height:18pt;
height:50px;
overflow:hidden;
font-weight:bold;
}

 .thumb-title h2 a:hover { 
}



 .stepcarousel .slideimg{
 float: left; /*leave this value alone*/
 background: #000 /*clip content that go outside dimensions of holding panel DIV*/
 margin:0; /*margin around each panel*/
 padding:0;   
 width:300px;
 height:300px;
 overflow:hidden;
 border-radius:15px;
 -moz-border-radius:15px; /* Firefox 3.6 and earlier */
 }

1 个答案:

答案 0 :(得分:0)

好的,这是我注意到的。我可以在你的页面上重现这个问题:如果我F5页面,那么一切看起来都很好。如果我然后调整浏览器的大小,图像会立即转到错误的位置。我在这里查看了.js文件的评论http://bitsybride.com/wp-content/themes/basement/js/slider.js?ver=3.4.2并在第9行看到了这一点:

  

// ** 8月27日,08' - 导航按钮(如果启用)也会自行重新定位   现在如果窗口调整大小

我开始查看.js文件,发现如果我删除了101-105:

$(window).bind("load, resize", function(){ //refresh position of nav buttons when page loads/resizes, in case offsets weren't available document.oncontentload
    config.offsets={left:stepcarousel.getoffset(config.$gallery.get(0), "offsetLeft"), top:stepcarousel.getoffset(config.$gallery.get(0), "offsetTop")}
    config.$leftnavbutton.css({left:config.offsets.left+config.defaultbuttons.leftnav[1]+'px', top:config.offsets.top+config.defaultbuttons.leftnav[2]+'px'})
    config.$rightnavbutton.css({left:config.offsets.left+config.$gallery.get(0).offsetWidth+config.defaultbuttons.rightnav[1]+'px', top:config.offsets.top+config.defaultbuttons.rightnav[2]+'px'})
})

在加载或调整大小时,左/右漩涡不会再“跳跃”。我逐步完成了代码,看到“offsetTop”正在某处改变。

所以。 。 。所有这些,请尝试编辑您的设置脚本以包含特定的“offsetTop”。我认为它正在代码中的某个地方“猜到”。它看起来完全像这样:

stepcarousel.setup({
    galleryid: 'mygallery', //id of carousel DIV
    beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
    panelclass: 'panel', //class of panel DIVs each holding content
    panelbehavior: {speed:400, wraparound:true, persist:true},
    defaultbuttons: {offsetTop: 242, enable: true, leftnav: ['http://bitsybride.com/wp-content/themes/basement/images/prev.png', -90, 120], rightnav: ['http://bitsybride.com/wp-content/themes/basement/images/next.png', 15, 120]},
    statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
    contenttype: ['external'] //content setting ['inline'] or ['external', 'path_to_external_file']
})