[英]imgAreaSelect not hiding on modal close, or scrolling with page
I'm using imgAreaSelect for an array of images, which users can toggle through by clicking < and > arrows. 我正在使用imgAreaSelect作为图像数组,用户可以通过单击<和>箭头来切换。 I was able to get the plugin working perfectly in my modal window when it was just one image, but somehow when dealing with dynamically setting the
<img id="image">
attribute, it does not like my css anymore. 当它只是一个图像时,我能够在我的模态窗口中完美地运行插件,但不知何故,当处理动态设置
<img id="image">
属性时,它不再喜欢我的css了。
Here's a jsfiddle of how the plugin should work, but with only one image: http://jsfiddle.net/B83Ck/ The imgAreaSelect plugin is applied directly to the image, no problems. 这里有一个关于插件应该如何工作的jsfiddle,但只有一个图像: http : //jsfiddle.net/B83Ck/ imgAreaSelect插件直接应用于图像,没有任何问题。
Unfortunately, this did not work with the JS I was using to toggle between images, as seen in the next jsfiddle. 不幸的是,这不适用于我用来在图像之间切换的JS,如下一个jsfiddle所示。 Instead, I figured I would try to apply the imgAreaSelect to the block element the image resides in: http://jsfiddle.net/8yz4t/ It looks great on select, but if you scroll up and down, you'll notice the select area stays fixed while the modal moves.
相反,我想我会尝试将imgAreaSelect应用到图像所在的块元素: http : //jsfiddle.net/8yz4t/它在选择上看起来很棒,但如果你向上和向下滚动,你会注意到选择模态移动时,区域保持固定。 Also, when you close the modal the selection remains visible.
此外,当您关闭模态时,选择仍然可见。
So here I am now. 我现在在这里。 I read a few things about adding
parent: '#parentblock'
to my imgAreaSelect instance, which you can see in this jsfiddle: http://jsfiddle.net/H4hEx/ This has the scrolling and close functionality I need, but it doesn't display on the image itself. 我读了一些关于添加
parent: '#parentblock'
到我的imgAreaSelect实例,你可以在这个jsfiddle中看到: http : //jsfiddle.net/H4hEx/这有我需要的滚动和关闭功能,但它没有' t显示图像本身。 It's kinda off to the side. 它有点偏向一边。 Any suggestions?
有什么建议么?
I finally managed to get this worked out, and most of it was publicly available knowledge, so I guess I failed. 我终于设法解决了这个问题,其中大部分都是公开的知识,所以我想我失败了。
I found this fix: Wrong positioning in Bootstrap modal window #39 我发现了这个问题: Bootstrap模态窗口#39中的错误定位
Along with making the parent: #parent
div style="position:relative;"
与制作
parent: #parent
div style="position:relative;"
Working jsfiddle here: http://jsfiddle.net/H4hEx/3/ 在这里工作jsfiddle: http : //jsfiddle.net/H4hEx/3/
Those who happen upon this thread in the future, don't be alarmed if the jsfiddle doesn't work, the link to the external resource for imgAreaSelect may have moved. 那些将来发生在这个帖子上的人,如果jsfiddle不起作用,不要惊慌,imgAreaSelect外部资源的链接可能已经移动了。 Just replace it with your own.
只需用你自己的替换它。 (I think that's how it works?)
(我认为它是如何工作的?)
Cheers 干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.