The code above, checks if the width of the screen is less than 500px(u can use any value), and then it hides the content of the loader.
This answer will give u a starting point
Open the snippet in full screen mode and reduce the screen size
/*For desktop no need to add media query*/
/*Put ur styles here*/
/*For desktop it take above styles */
/*For mobile */
/*u need to hide the text group*/
@media(max-width:421px) {
#text-group {
display: none;
}
}
<div id="loading">
<div id="dst"> Gif here </div>
<div id="text-group">
<h4 id="h4">Please Wait!</h4>
<p id="ntf">Please wait... it will take a second!</p>
</div>
</div>
The first call is the generic document “onready” function so when the page has fully loaded it will assign the button an onclick event.
The “spinner” function gets called when you press the “Sign In” button and it toggles the visibility of #overlay dynamically.
In the tag, or better yet in outside css file, add the two previously mentioned @media calls and the following CSS.
2
Answers
Using media query for mobile, you can hide the content of the loader on mobile devices.
Also you need to group your text content inside the loader, so that it will become easier to hide it
The code above, checks if the width of the screen is less than 500px(u can use any value), and then it hides the content of the loader.
This answer will give u a starting point
Open the snippet in full screen mode and reduce the screen size
Here’s my take on a solution. I’ll only make comments where I feel what I’ve done and what you’ve shown are different in some way.
First, my sample is using Bootstrap and Jquery, hence the following lines are at the top.
You still need both media queries.
When the screen gets smaller than 420px:
z
When the screen goes above 421 pixels, you want to reset the #dst.
I’ve added a tag to hold some jquery calls. OR… use a js file (preferred)
The first call is the generic document “onready” function so when the page has fully loaded it will assign the button an onclick event.
The “spinner” function gets called when you press the “Sign In” button and it toggles the visibility of #overlay dynamically.
In the tag, or better yet in outside css file, add the two previously mentioned @media calls and the following CSS.
The #overlay is the container for the “loading” section and for the blocking of controls using the tinted background.
z
z
z
Removed border: 1px solid #f5ba1a; Not really needed but you can add it back if you want.
Removed background. The background should only be associated with one container and that reusable container is #loading.
Removed position. It’s all self contained so this is not needed.
Removed display. It’s all self contained so this is not needed.
Changed z-index. Same reason I mentioned above.
Added padding-left and padding-right
z
Also notice that with this setup, the “loading” section is both vertically and horizontally centered as the screens resize.