用jquery移动图像 [英] move image with jquery

查看:113
本文介绍了用jquery移动图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于学校我正在建立一个移动网站。
有多个列,例如1个用于菜单,1个用于书的上下文,旁边的那个用于保存脚注和图像信息。

For school i'm making a website for a mobile. There are multiple columns, 1 for menu for example, 1 for the context of the book and the one next to that will hold footnotes and image information.

在手机上,你只能看到一列,陀螺仪手势将用于垂直滚动到下一列。

On the phone you will only see one column at the time, gyroscope gestures will be used to scroll vertically to the next column.

我只是无法移动图像。所以,如果有人可以提供帮助。
重要的是,在图像所在的文本中应该形成一个空白区域。此外,如果第一列发生变化,那么图像在第3列中仍然应该是正确的。因此图像应该具有相对于第二列的位置。
我有一个按钮来改变第一个colin的宽度以进行测试。

I only can't get the image moving. So if someone could help with that. What important is is that there should form a empty space in the text of once where the image was. Also if the first column changes then the image should still be correct in column 3. So the image should have it's position relative to the 2nd column. I have a button to change the width of the first colin for testing.

我创建了一个jsfiddle(我的第一个!)但它不起作用,但是在我的主机上代码工作的罚款除了图像不移动。所以我认为我在我的jsfiddle中设置了一些错误(如果是这样,请告诉我什么,所以我可以防止它下次发生)。 (ReferenceError:找不到变量:changeColumnWidth)

I created a jsfiddle (my first!) but it doesn't work, however on my host the code work's fines except the image doesn't move. So i think i set something wrong in my jsfiddle (if so tell me what please so i can prevent it from happening next time). (ReferenceError: Can't find variable: changeColumnWidth)

http: //jsfiddle.net/UpKAM/

推荐答案

试试这个:

$('.b_image').each(function() {
    var xPos = $(this).offset().left;
    xPos += 200;
    $(this).offset({'left':xPos});
});

http://jsfiddle.net/UpKAM/7/

这篇关于用jquery移动图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆