[英]highslide fixed position popup
I use highslide to popup. 我使用高幻灯片弹出。 I would like to have a stable position popup.
我希望有一个稳定的职位弹出窗口。
I tried: 我试过了:
hs.marginTop="120";
It works when I have a lot of text... When text is short, popup pops random. 当我有很多文本时,它会起作用...当文本短时,弹出窗口会随机弹出。 Usually at the right-bottom
通常在右下角
My code: 我的代码:
hs.graphicsDir = "./includes/highslide/graphics/";
hs.outlineType = "rounded-white";
hs.wrapperClassName = "draggable-header";
hs.marginTop="120";
$(function() {
var dialog=$(".siteText").html();
$("#highslide-html .highslide-body").html(dialog);
if(!$(".highslide-body").is(":empty"))
{
hs.htmlExpand(this, { contentId: \'highslide-html\' } )
}
});
HTML: HTML:
<div class="highslide-html-content" id="highslide-html" style="width:950px;color:black;">
<div class="highslide-header">
<ul>
<li class="highslide-close">
<a href="#" title="Close (esc)" onclick="return hs.close(this)"><span>Close</span></a>
</li>
</ul>
</div>
<div class="highslide-body">
</div>
<div class="highslide-footer">
<div>
<span class="highslide-resize" title="Resize">
<span></span>
</span>
</div>
</div>
</div>
EDIT: It works... But is very ugly effect... Popup jumps. 编辑:它起作用...但效果非常难看...弹出窗口跳转。 First is at the bottom, then jumps to top.
首先是在底部,然后跳到顶部。
if (!hs.ie || hs.uaVersion > 6) hs.extend ( hs.Expander.prototype, {
fix: function(on) {
var sign = on ? -1 : 1,
stl = this.wrapper.style;
if (!on) hs.getPageSize(); // recalculate scroll positions
hs.setStyles (this.wrapper, {
position: "fixed",
zoom: 1, // IE7 hasLayout bug,
left: (parseInt(stl.left) + sign * hs.page.scrollLeft) +"px",
top: "125px"
});
if (this.outline) {
stl = this.outline.table.style;
hs.setStyles (this.outline.table, {
position: "fixed",
zoom: 1, // IE7 hasLayout bug,
left: (parseInt(stl.left) + sign * hs.page.scrollLeft) +"px",
top: "120px"
});
}
this.fixed = on; // flag for use on dragging
},
onAfterExpand: function() {
this.fix(true); // fix the popup to viewport coordinates
},
onBeforeClose: function() {
this.fix(false); // unfix to get the animation right
},
onDrop: function() {
this.fix(true); // fix it again after dragging
},
onDrag: function(sender, args) {
if (this.fixed) { // only unfix it on the first drag event
this.fix(true);
}
}});
THX :) 谢谢 :)
Using hs.marginTop is not going to work. 使用hs.marginTop无法正常工作。 What you're after is hs.targetX and hs.targetY.
您所追求的是hs.targetX和hs.targetY。 These let you position the popup in a fixed position, no matter what.
这些使您无论如何都可以将弹出窗口定位在固定位置。 See the API: http://highslide.com/ref/hs.targetX .
参见API: http : //highslide.com/ref/hs.targetX 。 Pay attention to the requirement for a target "div" with an ID on it - it can be just an empty placeholder, but it has to exist.
请注意对带有ID的目标“ div”的要求-它可以只是一个空的占位符,但必须存在。
Just add 只需添加
.highslide-container
{
position:fixed; top:200px; left:-380px
}
in your highslide css that you are using and delete : 在您正在使用的高幻灯片CSS中并删除:
position: 'absolute',
left: 0,
top: 0,
only from the highslide script you are using from on the position given 仅从给定位置上使用的高幻灯片脚本
className: 'highslide-container'
}, {
position: 'absolute',
left: 0,
top: 0,
width: '100%',
zIndex: hs.zIndexCounter,
direction: 'ltr'
},
document.body,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.