I have currently installed prettyphoto and managed to launch an iframe on page load through
$(document).ready(function(){
开发者_如何转开发
What is the quickest way to add a delay to it?
The window.setTimeout
function in javascript is easy to use.
You probably do something like
$(document).ready(function(){
$('#photo').prettyphoto(); //Not sure how you call prettyphoto
}
Add a delay before you make your call :
$(document).ready(function(){
//The call to callPrettyPhoto will only be made after 1 second
window.setTimeout(callPrettyPhoto, 1000 );
});
function callPrettyPhoto() {
$('#photo').prettyphoto();
}
Note that you can also put the function inline if you wish to do so :
$(document).ready(function(){
window.setTimeout(function() {
$('#photo').prettyphoto();
}, 1000);
});
精彩评论