3
我想通过点击增加和减少图标来调整窗口大小。模式也应该位于屏幕中间后每个increase/decrease
点击。可调整大小的模式弹出式菜单
到目前为止,只有增加工作。任何人都可以阐明我做错了什么?
this.increaseModal = function() {
var maxHeight = ($(window).height() * 90)/100;
var maxWidth = ($(window).width() * 90)/100;
var height = ($(window).height() * 10)/100;
var width = ($(window).width() * 10)/100;
if ($('.modal-content').height() <= maxHeight - 100) {
$('.modal-content').height($('.modal-content').height() + height);
increaseHeightCount = increaseHeightCount + 1;
}
if ($('.modal-content').width() <= maxWidth - 100) {
$('.modal-content').width($('.modal-content').width() + width);
increaseWidthCount = increaseWidthCount + 1;
}
$('.modal-dialog').draggable();
$('#myModal').addClass('outPopUp');
}
this.decreaseModal = function() {
var maxHeight = ($(window).height() * 90)/100;
var maxWidth = ($(window).width() * 90)/100;
var height = ($(window).height() * 10)/100;
var width = ($(window).width() * 10)/100;
if (increaseWidthCount > 0) {
$('.modal-content').width($('.modal-content').width() - width);
increaseWidthCount = increaseWidthCount - 1;
}
if (increaseHeightCount > 0) {
$('.popup').height($('.popup').height() - height);
increaseHeightCount = increaseHeightCount - 1;
}
}
outPopUp
是我重写引导CSS用于改变模式窗口位置的类。
据我可以在DOM浏览器中看到,.popup没有分配给元素,因此增加/减少高度不起作用。
喜,是提高工作?因为在顶部,你说的是正在工作,但在最低层你说的是行不通的。你还可以显示你的HTML弹出?谢谢! – cweitat
继续@dsg写道,请创建一个[小提琴](http://jsbin.com/)或(甚至更好)为您的问题添加一个片段,以便我们可以看到问题。看到[如何问](http://stackoverflow.com/help/how-to-ask) –
点击增加图标,模态宽度增加..不是高度。减少完全不起作用,定位不会变为屏幕中间。 – dsg