![]() |
[jQuery] Simple Site Preloader with Effect - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: Resources (https://community.mybb.com/forum-8.html) +--- Forum: Tutorials (https://community.mybb.com/forum-38.html) +--- Thread: [jQuery] Simple Site Preloader with Effect (/thread-126447.html) Pages:
1
2
|
[jQuery] Simple Site Preloader with Effect - effone - 2012-09-20 Earlier we have learned a quick way to load the page with fade-in effect using jQuery. Movind forward based on that tutorial today we learn how to make a simple site pre-loader with CSS and jQuery. In the earlier tutorial we made the container hidden using display: none which caused the editor mess-up after loading the page. So, keeping that in mind we will not hide the page using display: none. We will use another trick to accomplish the job ![]() We will create our preloader in a div at the top of the site. The size of the div will be full screen (width: 100%, height: 100%) and the main page will be loading below the div. Now the hiding part: The remaining half-loaded page will easily be seen scrolling down. As we can't use display: none to the total page, we will just hide the overflow so that only full page loader remains visible and the user loses access to the remaining page. So, at the first hand, open your global.css. Find at the very beginning:
and add just after that: Save it. (let the global.css opened as we will need it again later).OK. Now we will create the full screen preloader div. Open your header template: ACP > Templates & Styles > Templates > {your_theme_name} Templates > Header Templates > header Locate the code at the very beginning:
and add just after that:
We have used MyBB's default spinner animation file. You may like to use your own spinner. Just change the file path in that case. Save the header template. Now we will do the sizing and positioning part in CSS. I'm commenting in the CSS for easy understanding of every line. Go back to your global.css and add at the end:
Save the global.css. Now the jQyery part. We will load the jQuery library and define spinner function. Open the headerinclude template: ACP > Templates & Styles > Templates {your_theme_name} Templates > Ungrouped Templates > headerinclude Locate the code:
Include the jQuery library before that:
In the same template locate the code:
and add our function after that:
Watch that the overflow of the body will set back to visible after page load by this function. Save the template. You are done. Now see what happens in your site ![]() Note: This tutorial is written keeping the newbies in mind. Apology to experts, I'm sure you can grab the gist of this guide in a second and can customize as you wish. Happy coding ... RE: [jQuery] Simple Site Preloader with Effect - Scois0n - 2012-09-20 I actually really like this! It would look perfect on a mobile theme, but i may add this to my current theme as well ![]() RE: [jQuery] Simple Site Preloader with Effect - Steeep - 2012-09-23 Thanks for the tutorial, I have installed the two effects in my forum ![]() You should get other :p RE: [jQuery] Simple Site Preloader with Effect - dhruvseth2002 - 2012-10-20 any demo bro ? RE: [jQuery] Simple Site Preloader with Effect - effone - 2012-10-20 Not live right now. But you can apply and see what happens, its a little work. RE: [jQuery] Simple Site Preloader with Effect - try8yes - 2012-10-21 nice tutorial one question how to see it at the middle of my forum... RE: [jQuery] Simple Site Preloader with Effect - effone - 2012-10-21 Adjust in CSS: #spinblock { .... margin: 250px auto; 250px is the pixel distance from the top. RE: [jQuery] Simple Site Preloader with Effect - try8yes - 2012-10-21 (2012-10-21, 04:55 AM)effone Wrote: Adjust in CSS: sorry i cannot see in my global css huhuhhhu RE: [jQuery] Simple Site Preloader with Effect - effone - 2012-10-21 Its in the code of this tutorial that you suppose to add in global.css. RE: [jQuery] Simple Site Preloader with Effect - try8yes - 2012-12-01 i just remove it it will slow my site huhuhhuhu |