Comments (5)
Hi @tompazourek !
Since version 1.1 the z-index of the overlay element is set to the target's z-index + 1:
https://github.com/CarlosBonetti/jquery-loading/blob/v1.1.0/src/loading.js#L218
You're probably using version 1.0.3 or behind... can you double check that?
It could not fix your problem entirely, though. I think it wouldn't work if the target element is inside the modal (and not the modal itself)...
If you don't want to update, this dirty hack should fix the problem:
$('#target').Loading().overlay.css('z-index', 100000);
Maybe I could also allow the default z-index to be set via options for the plugin, what do you think?
Let me know if any of these work for you...
from jquery-loading.
Hi Carlos!
Thanks for quick response. You're right, I was using v1.0.3.
I managed to solve the problem using this code:
$.Loading.setDefaults({
onStart: function (loading) {
loading.overlay.css('z-index', 1e9);
}
});
I'm not sure about the z-index being set via options, it doesn't add much benefit as opposed to setting it manually in handler. But it might be a little bit easier, since other people may experience the same issue and if it's a standard plugin option, they'll not have to dig in the source code.
I had an idea about a possible solution, which would be to look at all parents of the overlay element (I think jQuery's .parents()
is the function), and set the z-index to be greater than the maximal z-index found among its parents. I haven't tried it, but it might be a way to go.
When I was reading the code, I was a bit confused about the self.settings.fullPage
figuring in the z-index expression. Could you please explain how does it work with regards to the z-index? From the code it looked like it's a bool value.
from jquery-loading.
self.settings.fullPage
is a bool value, but it is evaluated to 0 or 1 and added to the final zIndex. I do that because the $('body').loading()
, which is a "full page" loading, will have a zIndex greater than the default zIndex by 1, so it will be on top of the default overlay elements. Of course this strategy fails on many scenarios, but these cases should be solved by the user.
The parents
ideia could solve many problems but I'm a little concerned about performance... I'm doing some experiments anyway. I'm also adding the optional zIndex
config to the plugin initialization, so other users could use:
$(...).loading({
zIndex: 9999
});
A little better than hunting the source code for manual fixes... it should be done on next version.
from jquery-loading.
I'm closing this since now it's possible to config the zIndex value for the overlay element otherwise the plugin will calculate it based on the target z-index (b8c2b20)
from jquery-loading.
Would be great if this information was added in the options documentation.
from jquery-loading.
Related Issues (19)
- Overlay doesn't hide and a second overlay appears over first one HOT 4
- How to destroy plugin instance? HOT 5
- $(...).loading is not a function HOT 7
- there is no destroy method HOT 3
- Does it possible to add a update message function? HOT 3
- Multiple loading with custom overlay HOT 1
- Submit button inside form tag doesnโt work in Safari HOT 2
- critical dependency error on laravel mix HOT 1
- Bad position HOT 4
- Issue using in a Bootstrap modal dialog HOT 3
- Error: Cannot find module '[object Window]' HOT 1
- the file of jquery.loading.min.js contains 'const' symbol
- can't mask all body when work with jeasyui
- Unable to use multiple instances on same element
- If you use multiple loadings, message does not change HOT 4
- Unable to get the overlay to display HOT 2
- loading('stop') displyaing the loading widget HOT 5
- Nuget package deployment HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-loading.