I'm trying to provide basic password protection for certain pages on a site. What I want to happen is when they enter the password, the new page fades in. What is actually happening is that "loading" flashes on the screen, then the old content (gallerychoose2), then the new content flashes twice and stays there. I can't seem to get it so that the page goes blank or says "loading" and is then replaced by the new content. This should be really simple, but I can't seem to get it to work! Any ideas? Thanks!
<head>
<title></title>
</head>
<body>
<script>
$("#words").html('<p> Loading...<\/p>');
//this script is to add password protection to a gallery.
var pw="demo";//change "demo" to whatever password you want to use.
var password=prompt('This is a password protected area, please enter your password to continue', '');
if (password.toLowerCase()==pw)
$("#words").load('landgallery.html', function(){
$("#words").fadeIn('600');
})
else if (password.toLowerCase()!=pw)
var password=prompt('Incorrect password, please try again.', '');
if (password.toLowerCase()==pw)
$("#words").load('landgallery.html', function(){
$("#words").fadeIn('600');
})
else if (password.toLowerCase()!=pw)
alert('Incorrect password. Please contact us to obtain your password.','');
Hi, I'm trying to get it so that a random picture displays from a gallery file one at a time. I'm probably making a basic syntax error somewhere as I'm fairly new to JavaScript/jQuery, but please can someone help? I can't get a picture to display in the div at all. Any help would be great, thanks!!
N.B. the pictures are called e.g. 101.jpg, 102.jpg - so I thought a random number generator would be best to get a random picture.
<script>
$(document).ready(function generatePic(){
function randomPicture() {
var min=101; var max=120;
var picture=Math.floor(Math.random()*(max-min+1))+min;
}
function bannerDisplay(){ $("#banner").fadeOut('400',function(){ $("#banner").load("pages/gallery/PhotoWall/images/'$picture'.jpg", function(){ $("#banner").fadeIn('600', randomPicture()) })})}
Hi, I've got some code that loads content into a div dependent on which menu item is clicked. However, when I'm getting the new content to fade in, sometimes it hasn't finished loading, so the old content fades back in, then flicks over to the new content. How would I use queue() in this context to get the content to finish loading first before it fades back in? I've tried to do it, but it just ends up with a weird flashing effect. Any help would be much appreciated!! Thanks!
I'm trying to get it so that when I click on a menu item, the old content in the content div slides up, and then the new content slides up to replace it, and I can't get it to work. I've only included code for the first menu item as an example. What am I doing wrong? Any help would be much appreciated!! Thanks!