Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8494163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:13:28+00:00 2026-06-10T23:13:28+00:00

I am making a photo slider. If you click the previous or next button,

  • 0

I am making a photo slider. If you click the previous or next button, the margin-left keeps adding or subtracting a variable, which is set to 5px. However, I want to limit the distance the slider goes left or right, so that it doesn’t slide so far that there is white space.

To limit the boundary, there is a conditional statement that assigns the variable a value of 5px if the margin-left is between 10px and -100px. Otherwise, the variable is set to 0px.

And this does work. If you go too far to the left or right, the slider just stops. But once the boundary is met, the previous and next buttons do not work. Any tips?

You can view my code here:
jsfiddle.net/xpfbh/2/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:13:29+00:00Added an answer on June 10, 2026 at 11:13 pm

    I have updated your fiddle. I had to change your if condition to include the margin range as well as the direction. Also removed the test variable and moved the statement which sets the margin within the if block. I didn’t think the else block was needed, so I removed it as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am making a app which takes photo on button click i have camera.java
I'm making a photo managing app. I have created a class called photo, which
I'm playing around with jQuery for the first time, making a little photo slider
I'm making an app in which I need to make some photo effects similar
Making a word document of our network set-up. We have about 7 servers and
Making an adobe flex ui in which data that is calculated must use proprietary
I am making my own photo album, and want to copy the functionality of
I am making a little family photo album, with the intention to maybe open
So I'm making a Rails app which allows Users to create Items, and each
I'm trying to make a photo feed for an app I'm making, similar to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.