0

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

如何重现:转到我网站上的页面。单击标题徽标以访问主页。按 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 */
 }
4

1 回答 1

0

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

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

我开始查看 .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']
})
于 2012-11-15T02:57:07.067 回答