Reputation:
jQuery.preloadImages = function() { for(var i = 0; i<arguments.length; i++) jQuery("<img>").attr("src", arguments[i]); }
$(function() {
$('#background-wrap img').css('opacity',0);
$('#background-wrap img').animate({ opacity: 1}, 3000);
});
It's not doing performing of the functions that are in the code. Where did I mess up the syntax because I can seem to figure it out myself?
Cheers!
Upvotes: 0
Views: 72
Reputation: 50982
<img>
should be replaced with
img
jQuery.preloadImages = function() { for(var i = 0; i<arguments.length; i++) jQuery("img").attr("src", arguments[i]); }
$(function() {
$('#background-wrap img').css('opacity',0);
$('#background-wrap img').animate({ opacity: 1}, 3000);
});
Upvotes: 0
Reputation: 7717
Instead of:
jQuery('<img>')
Use:
jQuery('img')
Also, read jQuery Plugin Authoring for information about how to extend jQuery. In the code above preloadImages()
is also not being called.
Upvotes: 1