I have a Wordpress site that has numerous large images (full screen background image scroller) and when I go to my page it goes 'pixel-ly' and looks broken until fully loaded.
What is the proper procedure to load a websites images so the users first look at the site isn't broken or glitched?
Hide everything until the page is loaded. Show a loading screen in the meantime if you want.
<body onload="document.getElementById('loading').style.display = 'none';document.getElementById('content').style.display = 'block';">
<div id="loading">Some loading text or icon goes here...</div>
<div id="content" style="display:none;">Main content goes here...</div>
Block page from user interaction until all images/components are loaded. It isn't too complex - use jQuery.
it is already answered in
prevent user to perform any actions while page is loading
Related
I have made some modifications to a website I am working on and now, when I load the homepage, the header image seems to load after the rest of the page leaving a white space and then the image loads it pushes the rest of the page down to where it should be. This site is created from scratch with HTML, CSS and JS. The website is https://www.visionwebdesign.ca so you can have a look. Once the webpage is in the browser cache, it loads fine.
The header is actually a part of a carousel of images. Here is the code I am working with:
Vision Web Design
...
I have tried reducing my images to a smaller size but no luck there. Looking for any help available.
J.P.
This is probably not the answer you are looking for, but looking at the HTML page code it appears you are just loading in the images quite normally using IMG tags, no script code in use there, so any delay may simply be the time it takes for the images to download from the server to the browser. I saw just a bit of a delay in loading the header image (tried in both Firefox and in Chrome) but I'm on a 300Mbps down internet connection so everything is fairly quick.
Image size may be one thing to look at. Alternately setting the content DIV to display:none until after the first image has loaded then switching it using Javascript. I found this example here at Stack Overflow:
A method of solving this problem would involve hiding the full body for the 2 seconds or however long it takes to load the body. We can do this using Javascript:
var timeouttimer = setTimeout(showbody, 2000);
var everything = document.getElementById("allcontent");
function showbody {
everything.style.display = "block";
}
And then in the HTML add the following div surrounding all the content of your webpage:
<div id="allcontent" style="display: none;">
I am building a website and when I click on one of my header's page links, it loads the whole page again, rather than preserving the header and only loading the main content. For example:
When you click on a button on the sidebar of YouTube, it will, for example, load the watch later playlist, and preserve the search bar and sidebar. How would I go about doing this on my website?
Have a look at using aJax. This should resolve your issue.
I'm trying to eliminate the white flash between loading local pages within my iOS Phonegap app.
I've tried everything but I still can see white between page loads.
I've tried making my html background black, using data-transition=none and also making the webView backgroundcolor clear.
I've put::
NSLog(#"BEGIN EDIT - set webView to transparent");
[self.webView setBackgroundColor:[UIColor clearColor]];
[self.webView setOpaque: NO];
NSLog(#"END EDIT - set webView to transparent");
In the CDVInAppBrowser.m , in the CDVViewController.m and in the AppDelegate.m but nothing seems to work! Maybe I'm placing the code in the wrong position.
Please someone just help me get rid of the white between page loads!
PhoneGap loading can be quite slow. You may need to use the splash screen API to show and hide splash? http://docs.phonegap.com/en/2.8.0/cordova_splashscreen_splashscreen.md.html#Splashscreen
On the page above, also pay attention to iOS Quirk section. Alternatively, have you try single page application with jQuery Mobile or AngularJS?
I had the same problem when I made a mobile application with Phonegap.
I don't know how do avoid these flashes but when you've built a simple app with only a few screens you could implement all your HTML documents into one file like:
<html>
<body>
<div class="page" id="page-1">
Content of page one
</div>
<div class="page" id="page-2" style="display:none;">
Content of page two
</div>
<div class="page" id="page-3" style="display:none;">
Content of page three
</div>
</body>
</html>
Now you could switch between the contents of each container by making it visible/invisible for the user.
The idea behind this solution is that all of your app's content will get loaded once (at the beginning) and with jQuery you will switch between the content without these white flashes when the webbrowser has to render the new page the user has been redirected to.
This is a good solution only when your app does not contain too much contents.
like I said, making the app a single file was not possible in this case due to the complexity of it and I don't mind if the white flashes between page loads are black since they don't take long. Here's the solution I've found using Phonegap 2.8 for iOS:
In the CDVViewController.m
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
// Black base color for background matches the native apps
theWebView.opaque = NO;
theWebView.backgroundColor = [UIColor blackColor];
//the rest of the codeā¦
Hope it's useful to someone else.
i want to design a website who contain 4-5 page but i need a feature then when user click on any link the content is changed without any other page load. how i can do this
my page look like this
but when user click on left side or right side link the content is load without page refresh. how i can do this.
jQuery UI tabs?
http://jqueryui.com/demos/tabs/default.html
You can either use frames or load content via Ajax.
I'm interested in the way lala.com works. They have a header that remains fixed at the top of the browser and they have a flash music player in it.
You can click on other links in the site and they are displayed below the header but the header is not disrupted and can continue playing music.
If the target is a modern browser say IE8 & FF 3.6, what's the best way to achieve this?
Thanks for any help.
Frames / Iframes
One way to achieve this is to create a frameset or use iframes to show the sub pages. The top (or bottom) frame would be a very tiny one, and containing your music player. The big frame would contain the page that is being browsed. This technique is used e.g. by Google when clicking on an image search result.
This method has its downsides: The user will see your URL in the address bar and not the one of the page being browsed. If the user enters something in the address bar, they will leave your frameset. It is not possible e.g. to write down the URL of the current page.
Ajax
The second, better way is to build a navigation that loads the other pages into the current page through AJAX. See an example implementation here.
This will provide for smooth loading, music will continue to play. If done right, it is even possible to retain a healthy link structure that won't break external references, and have the "back" button work. The tutorial I link to covers both aspects. Just be careful, it's a 3-part tutorial.
It works with JavaScript enabled only, though, but there are solutions that downgrade gracefully (falling back to the "normal" behaviour of switching pages when JavaScript is turned off).
Besides frames, you can do partial page refreshes with ajax. Instead of fully loading a new page on each action, you would do partial page refreshes. You can keep bookmarking and the back button functionality through careful coding. Libraries such as jQuery (and lots of others) make using ajax across different browsers signficantly simpler. EDIT A quick search revealed a Stack Overflow question on back button plugins for jQuery. So, if you use jQuery you can make this approach even easier.
Here's some stub code:
HTML
<html>
<head>
<!-- ... -->
</head>
<body>
<div id="music-header">
<!-- ...Music header content goes here -->
</div>
<div id="content">
<!-- ...Body of different pages goes here -->
</div>
</body>
</html>
Javascript is provided in the link I provided on how to handle bookmarking and the back button.
This specific example lala.com is done using iframes.