Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Screen name:
NadjaBordeaux
NadjaBordeaux's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Ideas
Problems
Expanded view
List view
Private Message
gallery with background images on body and previous next buttons
[3Replies]
19-Feb-2015 09:13 AM
Forum:
Using jQuery
Hello,
I am trying to create a gallery with prev/next buttons for background images on the body tag.
The images are in an array and called by index.
I can't call the first image and my buttons stop working at img 3
Any help would be highly appreciated.
I also created a fiddle
here
var Images = ['bg_01, bg_02', 'bg_03', 'bg_04', 'bg_05', 'bg_06', 'bg_07', 'bg_08', 'bg_09', 'bg_10', 'bg_11', 'bg_12'];
var ImgLength = Images.length;
$("body").css("background-image", "url(../img/" + Images[0] + ".jpg)");
$('#panel .left').click(function () {
if (ImgLength > 0) {
ImgLength = ImgLength - 1;
} else {
ImgLength = 0;
}
$("body").css("background-image", "url(../img/" + Images[ImgLength] + ".jpg)");
return false;
});
$('#panel .right').click(function () {
if (ImgLength < Images.length - 1) {
ImgLength = ImgLength + 1;
} else {
ImgLength = 0;
}
$("body").css("background-image", "url(../img/" + Images[ImgLength] + ".jpg)");
return false;
});
«Prev
Next »
Moderate user : NadjaBordeaux
Forum