Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/454.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 图像不断移动_Javascript_Wordpress - Fatal编程技术网

Javascript 图像不断移动

Javascript 图像不断移动,javascript,wordpress,Javascript,Wordpress,我的主题在主页上有一个滑块,上一页和下一页的图像会不断上下移动 如何复制: 转到上的一页。 点击标题标志进入主页。 按f5。这就是左右漩涡的位置 主题创建者没有响应,也没有任何论坛可供帮助。您能告诉我应该对此进行哪些修改吗: <script type="text/javascript"> stepcarousel.setup({ galleryid: 'mygallery', //id of carousel DIV beltclass: 'belt', //class of inn

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

如何复制: 转到上的一页。 点击标题标志进入主页。 按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>

好的,这是我注意到的。我可以像这样在你的页面上重现这个问题:如果我把页面放大,那么一切看起来都很好。如果调整浏览器的大小,图像会立即转到错误的位置。我在这里查看了.js文件的注释,并在第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”在某个地方发生了变化

所以。总而言之,请尝试编辑您的设置脚本以包含特定的“偏移”。我认为它在代码的某个地方被“猜测”。它看起来就像这样:

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']
})

尝试将moveby:3与任何其他数字一起更改,看看会发生什么。他们不会在Chrome中为我跳转。你解决了吗?moveby:3将滑块移动了3个图像。我只有3张图片,所以它不会移动。不,不幸的是它没有工作。另外,当我从.js文件中删除这些行时(只是为了看看会发生什么),漩涡完全消失了。我去掉了正确的部分。现在它们垂直固定,但水平移动。它们似乎固定在左侧。知道怎么解决吗?
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']
})