JQuery :: Hide Until Background Image Loaded?
May 17, 2010
I have a set of divs on my portfolio page that all share the common class 'module', with an additional class that determines the background image.I currently have this function that I thought would keep each instance of .module hidden until it had loaded:
$('.module').ready(function(){
$('.module').fadeIn('9000');
});
I'm not certain but I think the 'ready' only refers to the HTML content and ignores the fact that the background image (defined in css) isn't ready.Is there any simple way I can make each div stay hidden until the background is loaded, then perform show() or fadeIn()???
The page in question can be found at http:[url]....
View 1 Replies
ADVERTISEMENT
Dec 2, 2009
I'm using a double background image for a site - basically two containers around everything, one with a gif with patches of different colour, and above it a semi-opaque png with a very faint texture. I'm doing it this way as it makes for much faster loading than one jpg with the image and texture combined.
The only problem is that you see the gif load first, then the texture goes over it. Is there any way, perhaps with JS, to hide these background images until they're both fully loaded, then display them together?
View 4 Replies
View Related
Jun 25, 2007
Is there any way to detect if a background image was loaded sucessfully and then instruct the browser to try that image again if it was not?
View 6 Replies
View Related
Sep 15, 2011
I am loading some content dynamically using the .load() function in jQuery.So once the content is loaded, div#slider moves to reveal the new content. The div will move once all the text is loaded but not the images, which is fine. The images will be loading when the viewer first clicks on a.load-button.What I'd like to do is to hide the image until it is fully loaded into the cache, have an animated 'loading' gif as a background image, then BOOM, the image appears in one go with .show();I'm a little unsure how to approach this, since I'm already using the .load() callback function. I've tried using $(window).load(function(show image)), but jQuery dosen't like that.
View 6 Replies
View Related
May 27, 2010
I want a background image of a tick to appear in each coloured box in my attached image onclick. When another coloured box is clicked I want the image to show in that one and then hidden in the previous one clicked. There should be no ticks shown on page load.I'm clueless as to how to do this.Here's my code for the image attached:
<div class="colour-picker">
<div class="tick-off" id="red" onclick="changeclass();">
</div>
[code]....
View 1 Replies
View Related
May 25, 2009
I created a slideshow using the cycle-lite pluginLINK. LINK TO SLIDESHOW The slideshow is nearly great. The first time you load the images it is a bit bizarre. The images loads and fades at the same time.
Is there a way i can hide the images until all has loaded then trigger the slideshow.
[Code]...
View 3 Replies
View Related
Sep 22, 2011
I'm working on an embedded device and I want to display only part of the original configuration page by building a jQuery page on top of it. Unfortunately, the code that generated the pages was not ajax friendly in the sense that the only way I have to identify the parts I want to show or hide is the class attribute. Up to now, I've been able to load the page with the simple code:
<div class='contentcontainer'>
<hr> <div id="content">
</div>
</div> <script type='text/javascript'>
[Code].....
But it doesn't work. Then I read on the [URL] that I would need to wrap it:
Chris Moore
9 months ago
If you want to load some content into a div and then manipulate it afterwards ((ie: loading something your use a template for a message window and then want to change the message contents) you *must* do it by wrapping it in the completed function handler..
Don't just throw it a few lines down, you'll get random chances that the selector will
how I should do this? Do I need to replace the test() function by a function that will do the post treatment? How then?
View 3 Replies
View Related
Jun 24, 2011
I am doing an image/data rotating script. I get the data from a XML. I parse that data and build the divs and such.Data Set 1 --- background image in a div, with a button and some text overlayed on the div.
...
...
Data Set 4 -- etc..The thing is, I load the script and the div appears, BUT the text overlay appears first THEN the image pops up for the first Data Set. I can't have that. I need them both to appear at once.Is there a way to determine that a div background image is loaded?-- I have access to the prototype js library.
View 4 Replies
View Related
Jan 14, 2011
How to display loading gif image until the big image have loaded? Now I have the html and js but it doesn't work. Anyone have some idea or solution ?
[Code]...
View 1 Replies
View Related
Oct 30, 2010
which works once the page hasn't been loaded using.load $(".toggle_cat_container").hide(); How do I adapt it to work when the page is loaded with .load? I am familiar with needing to use .live on click functions.
i.e.
$("a[id^='mydiv']").click(function(e) {
needing to be changed to:
$("a[id^='mydiv]").live('click', function(e) {
My problem is that $(".toggle_cat_container").hide(); would trigger when the document was ready but when its loaded it won't trigger. What adaptation do I need? I suspect something similar to the below - just not getting it right $(".toggle_cat_container").live('onLoad', function(e) {
View 2 Replies
View Related
Jan 27, 2011
I have a client that wants a new background image every time page is reloaded. I thought I have to script and thought I had it working but when I applied it to all my pages from a template I made in dreamweaver it doesn't work. It only works on the template.
See code below.
<head>
<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
//-->
</script>
</head>
<body>
<script>
var randombgs=["../images/main_background.png", "../images/main_background2.png", "../images/main_background3.png", "../images/main_background4.png", "../images/main_background.png", "../images/main_background2.png", "../images/main_background3.png", "../images/main_background4.png"]
document.write('<body background="'+randombgs[Math.floor(Math.random()*randombgs.length)]+'" bgcolor="#FFFFFF">')
</script>
</body
View 1 Replies
View Related
Jul 15, 2011
I am building a simple t-shirt creator app for my shop and I am using the interface.js library: [URL].. docs/drag to drag/drop and re-size the graphic on the shirt background image.
Once the user has chosen a spot to put the graphic, how do I save the background image of the t-shirt with the image they dropped in the correct spot? Like, to merge the two graphics in place?
View 2 Replies
View Related
May 12, 2010
I have a div set up like this
<div id='y' style='background-image: url(./randomcolor.php?ibase=
<?
php echo $entity
->
[code]....
I am having an issue with setting the background-image of a another div #x to the background image of #y.Correct me if I am wrong but I think you would do this in a simple case by saying
$
(
'#x'
).
[code]....
So when it does it, it is getting the URL of the generator (I logged it. what is actually being passed is [URL] This would require a server call to generate a new image, In this particular application, even if it wasn't exactly the image y had it would be acceptable. But it's not doing it. It is not getting any image at all. Am I doing something wrong, i.e. is it supposed to just work? I would think not, since the page has already been rendered. This is almost an ajax situation but I don't know how to do it for an image. I don't really want to generate a new image anyway, I'd be very happy to get the one that's already there. How would I access the actual image already attached to y and not do another server call?
View 2 Replies
View Related
Apr 24, 2009
I am absolute javascipt newbie so please threat me like that I need the following functionality to my webpage: Let's say I have a div with some unique ID on my page. Now, what I need is to show this div on my page only the first time visitor opens a page, and then not show it every next time he/she opens it for next 24h.
So I need to set a cookie that hides div from page if it has already been shown to visitor, for next 24h,so that the content of this div will be shown to each unique visitor only once for a day.
View 2 Replies
View Related
Nov 29, 2010
"How to hide div so his content won't be loaded until he is visible?"
And is it possible to add preloader for that div?
View 8 Replies
View Related
Aug 28, 2009
I have this working fine, and I can append the preloaded image to a hidden div then fade the div in for a smooth effect.
Problem is I want to set this preloaded image as a css background image, not as a <img /> in a container. But if when the image is loaded, instead of .prepend() I do .css() and set the css property of a background-image to be the preloaded images URL, then when it carries on with displaying it the browser loads the image again. Rather than using the preloaded one.
I want the image to be a background image as I want it centered in the page background, even if it is too large for the viewport.
View 1 Replies
View Related
Jun 10, 2009
I have a LARGE, hi-resolution image that I am trying to use as the background for a page. Because it is so large, it takes a while to download. Because of this, I wanted to load the image behind-the-scenes and show it once it is downloaded.
To accomplish this, I'm using the following JQuery code:
This code clearly downloads an image and appends it to my DIV element. However, I really want to set this downloaded image to the background-image CSS property of my DIV. The reason why is because I have content inside the DIV that should serve as the foreground.
How do I dynamically download an image, fade it in, and use it as a background?
View 1 Replies
View Related
Dec 13, 2011
I'm creating a script to get the next photo without reloading a webpage. To make it more smoothly, I fadeOut() the old image, and fadeIn() the new image.
However, when the new image is not yet fully loaded, the fadeIn() method doesn't really make sence. So I wonder if there is a way to first show an ajax loader, and after the new image is fully loaded, fadeIn the new image.
This is how far I got so far :-)
I first have to remove the first img tag, and inject a new one in the DOM, otherwise the old image flashes for a second, before the new one appears ;-)
[url]
View 9 Replies
View Related
Aug 23, 2010
I am loading an html page using the .load() function into a div called content. I have an overlay that is the same size as the div (I do this for a transparent effect).So with the .load() function in the callback I set the overlay div height to the content div height.. which works fine except when there are images. Since the images aren't loaded yet the div height will be smaller than actual size.[code]and the html file can include anything such as video or images.I tried doing a .delay(1000) just to see if that would fix it but didn't seem like the delay was working.How would I properly set the overlay div height to the content div height AFTER the images have been loaded?
View 2 Replies
View Related
Jan 6, 2010
I want to know if there is a possibilty to check with JQuery if an image can be loaded or not? Because when an imgae can't be loaded the Jqzoom should not work, because the big image (which is for the zoom) could not be loaded. Imagin I have hundreds of pictures, how can I check if this big image could be loaded or not?
View 4 Replies
View Related
Jun 4, 2009
how can i find the size of an image element which got loaded via ajax?
View 2 Replies
View Related
Sep 10, 2010
I'm trying to fade a large background image in after it's loaded, here's the JS:
Code:
//the image is contained in a div with the id of "stage"
$(document).ready(function() {
$('#stage img').hide();[code]....
This works fine in Firefox/Chrome but not in IE8 (I haven't tried the older versions yet).
View 2 Replies
View Related
Jul 6, 2011
I have a form with three fields. When the user changes the value of field1, the form displays either field2 or field3. This works fine for NEW records.However, I'm running into a problem when trying to EDIT an existing record. When the form is loaded, I need to test the value of field1 and display either field2 or field3. I've tried using the form onload event, but do not know how to access the value of field1.I'm using Javascript and div tags.This is what I have so far.
<script type="text/javascript">
function hide(obj)
obj1 = document.getElementById(obj);
[code]....
View 7 Replies
View Related
Sep 29, 2009
I need to fadeout an image after a delay when a page is loaded, then redirect it to another page.
View 3 Replies
View Related
Aug 7, 2010
I am using the code below to load a resource via AJAX that contains a <ul id="photoCollection"> . That list has an image in each of its <li> tags. This markup and images are getting loaded as expected into the target Div#photoCollectionWrapper.
$('#photoCollectionWrapper').load('/photo_collections/1/photos', photosLoaded());
Once the images are loaded into the target div with AJAX I need to select them so I can alter their widths and heights. So far, I have been unable to select them as expected once they are loaded. However, If I just load them in a new page with NO AJAX, then buy using a simple .load() event handler I am able to select them after they have completely loaded as expected. No problem.
But when loading the resource via AJAX I am unable to select them at all. I am using a callback that gets fired after the AJAX is loaded. Then in there it seems "logical" to call my .load() handler on the images loaded in via AJAX. Here's a sample of some code just to illustrate the idea. The code below actually will not run at all. If I remove the .load() bit it will, but then Alert always returns null.
function photosLoaded() {
$('#photoCollection li img').load(function() {
alert($('#photoCollection li img').height());
}
}
I have also tried many css selector variations to try and select the target images, but to no avail. I know for sure photosLoaded() is getting called. I just can't select the elements that the AJAX call brought in.
View 1 Replies
View Related
Nov 23, 2010
I tried something like:
$('img').load(function() { /*code*/ });
it will work?
View 2 Replies
View Related