-
Notifications
You must be signed in to change notification settings - Fork 692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set dialog position #222
Comments
About the first part with positioning. I won't introduce something related to mouse position into API of the ngDialog. I would better introduce some About second part with width / height / scrolling. It's more CSS related. Take a look at #251 |
Adding a position parameter looks great and will suit most of user cases, but to be honest I was wondering if there wasn't already something allowing it since there is some append function. Regarding the second part, I'm already using the plain theme with custom width that allows me to choose the width of the dialog. |
@Seiifer so I am going to add positioning support for the next versions. Thanks for idea. Regards max height - will |
Regarding the height, you intend to make the dialog content scrollable if it reaches the max height ? Ideally, the best would be to be able to set width and height. For example, replacing |
Yes. About height things - please create separate issue or submit PR with more precise explanations. I am going to keep this issue for tracking progress related to positioning of the dialog. |
I need to change the position of the dialog for small devices (via @media). I've been looking for a ngDialog position parameter, but couldn't find anything... was about to go through the code to add one myself, when I saw this posting... Any idea when you'll have this change posted? Alternately, if the position could be relative to the display area (as opposed to the page size), then I could avoid @media altogether. Much thanks - awesome job! |
@bfree-github looking at doing this in upcoming 1-2 weeks, but can't be precise; quite busy at my job last days. You could submit PR if you want this ASAP. |
Understood - thanks! |
Oh wow - going through the code, I found that padding-top does exactly what I'm looking for. I just set it to 15% and it works the way I want on all devices! Thanks! |
A |
Hello, I've written a couple of services to make the dialogs adapt automatically to the window height, including a scrollbar: First, send an event whenever the window is resized: angular.module('myApp').directive('resize', function($window, dimensionService) {
return {
link: function(scope, element, attrs) {
angular.element($window).on('resize', function() {
scope.$broadcast('resize::resize', dimensionService.getWindowDimension());
});
}
};
}); angular.module('myApp').factory('dimensionService', function (ngDialog, $window, $document) {
var DimensionService = {};
DimensionService.getWindowDimension = function() {
var w = $window,
d = $document[0],
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {'innerWidth' : x, 'innerHeight' : y};
};
return DimensionService;
}); <body ng-app="myApp" resize> Then, listen to both the resize event and the dialog-opened event and set the dialog content panel's height accordingly: angular.module('myApp').factory('dialogService', function (ngDialog, dimensionService) {
var DialogService = {};
DialogService.open = function(scope, dialogParams) {
var dialog = ngDialog.open(dialogParams);
function updateMaxHeight(windowInnerHeight) {
$('#' + dialog.id + ' .ngdialog-content').attr('style', 'max-height:' + (windowInnerHeight * 0.8) + 'px; overflow-y: auto');
}
scope.$on('ngDialog.opened', function (event, $dialog) {
updateMaxHeight(dimensionService.getWindowDimension().innerHeight);
});
scope.$on('resize::resize', function(event, windowSize) {
updateMaxHeight(windowSize.innerHeight);
});
};
return DialogService;
}); Hope that helps you! |
That's great - much thanks! |
you're welcome! Change the factor 0.8 as needed |
Hello, Is there any updates on adding 'position' to available dialog options? Tnx |
Currently no, I am too busy at my full-time job. You could contribute by writing actual code & opening new PR. This will be appreciated a lot. This feature request is on top of priority list and I am going to. But feel free to contribute if you need it ASAP. Just warn me beforehand if any of you is going to implement this yourself in the nearest time. This is needed not to do the same work later from my side. Thanks for understanding. |
I might have some bandwidth to work on this next week. I'll let you know what how I plan to do it before submitting changes. Thanks! |
@bfree-github bump |
Hi there! |
@iambkg no news from our side :( Until the next year I won't have enough time for ngDialog. |
Sorry for my delay - I just came out of ER for angioplasty and 2 stents for 3 blocked arteries. I’ll try to look into after I recover - Bob
|
Hi guys! |
Hope you recover swiftly and fully, @bfree-github |
@iambkg |
@markzolotoy let dialogContainer: JQuery = $('.dialogClassName'); // get dialog container by class name
if (dialogContainer.length > 0) {
const dialogTop: number = 15; // hardcode just for example, we use some calculations here
const dialogLeft: number = 20; // here too
dialogContainer.css({top: dialogTop + 'px', left: dialogLeft + 'px'});
} And we create dialog this way: //...
this.dialogResult = this.ngDialog.open({
className: 'dialogClassName' // there are more options here, skip them as they are not needed here, I think
});
//... |
Any news on adding position parameter to the ngDialog? :) |
There will be no news until someone submits a PR 💃 |
I have recently used ngDialog on a project and was able to figure out how to move the placement of the dialog by changing the css (i.e. changing the margin for the .ngdialog-content). I would be willing to implement a fix for this but wanted to check if the following solution would work:
If this seems like a feasible solution or if you have alternative solutions please let me know. Thanks Shannon |
I might suggest using jQuery UI position and accepting the same arguments - that would allow for nicely expressing the position of the dialog relative to another element, with flexibility around how it behaves around edges of the viewport. |
We're not adding a jQuery or jQuery ui dependency for this project |
the |
Hi, thanks for this usefull tool you are providing.
I was wondering :
Is there a way to set the position of a new dialog ?
I tried a few things with appendTo but it didn't work for me. I wish to open mydialog depending on the current position of the mouse. The ideal would be to :
Also, is there a way to specify a dialog's width and height ? And making its content scrollable if it requires more than the given height (scrollable or height-extendable by clicking on a specific element in the bottom of the dialog otherwise)
Regards
The text was updated successfully, but these errors were encountered: