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 6126327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:21:33+00:00 2026-05-23T16:21:33+00:00

I am looking to use jScrollPane on my new website and am having some

  • 0

I am looking to use jScrollPane on my new website and am having some troubleshooting problems with it. Searched up and down for answers but couldn’t find any.

Please take a look at the website here: http://www.giamarescotti.com/v2

Instead of specifying a definite width to .scroll-pane, I would like it to expand according to the content because it’s impossible for me to keep recalculating the width as I update my website regularly.

*Due to being a new user, I am unable to post images and codes. Please view the source file at the website.

Any help is appreciated. Thank you very much!

Regards,
Dave

  • 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-05-23T16:21:34+00:00Added an answer on May 23, 2026 at 4:21 pm

    I think this could be what you are looking for. The demo here shows you how to autoReinitialise the width of a container if the content inside of it changes.

    http://jscrollpane.kelvinluck.com/dynamic_content.html

    Or if you are setting the width of the container as a percentage, take a look at this demo

    http://jscrollpane.kelvinluck.com/dynamic_width.html

    Try replacing your current jScrollPane JS with the code below

    $('.scroll-pane').jScrollPane({
        showArrows: true,
        autoReinitialise: true
    });
    

    Hope that helps

    UPDATE:

    Hmmmmm I don’t have much time right now, but you could do a really simple bit of jQuery to calculate the width for you…

    Then remove the p tag from around your images and replace it with a div tag that has an ID that refers back to the above JS. (By the way a p tag is a Paragraph tag, for text!)

    Lastly set a fall back width in your CSS so that people without JS don’t see loads of images going down the page.

    A better fix that uses only CSS should really be found, I’ll look into later if I get time!

    2nd UPDATE

    Right, lets sort that 1-3% of final details out 🙂

    The margin of 5 was just a rough guide as the browsers themselves are adding a margin/padding to your images. Let’s add a fixed 5px margin to each image apart from the last one.

    Your JS would be mostly the same, except that you will need to -5 from the calculated total width because we will be removing the 5px margin from the last image.

    var totalImages = $("#images img").length;
    var imgWidth = 452 + 5; //width of an image plus the margin
    $("#imagesContainer").css("width",totalImages*imgWidth - 5);
    
    $('.scroll-pane').jScrollPane({
        showArrows: true,
        autoReinitialise: true
    });
    

    Next we will give a class to your last image in the list called lastImage like so

    <div id="imagesContainer">
        <img src="images/food.jpg" />
        <img src="images/food.jpg" />
        <img src="images/food.jpg" />
        <img src="images/food.jpg" />
        <img class="lastImage" src="images/food.jpg" />
    </div>
    

    Now the CSS

    #imagesContainer {
    width:5000px; /*fallback width*/
    overflow:hidden;
    }
    
    #imagesContainer img {
    display:block;
    margin:0 5px 0 0; /*adding a 5px margin to the right*/
    padding:0;
    float:left;
    }
    
    .lastImage {
    margin-right:0 !important; /*removing the margin right from the last img*/
    }
    

    Now each image has a 5px space between it. IF you wanted no margin then just change margin:0 5px 0 0; to margin:0;, remove the lastImage class and CSS and remove the +5 and -5 from the JS!

    Hope that helps!

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

Sidebar

Related Questions

I am looking to use quartz to schedule emails, but I'm not sure which
I am looking to use a javascript obfuscator. What are some of the most
Looking to use FastLZ in Python, or something similar. Tried Google and didn't find
I am looking to use this plugin: http://keith-wood.name/countdown.html but I need to use the
We are new to rails and are looking to use the Javascript SDK Connect
I've noticed FLVs are ubiquitous in flash video, but I'm looking to use MP4s
I am looking to use CKEditor in ASP MVC application. I have been having
I am looking to use Entity framework as database layer in my application, but
I'm looking to use markdown in my website, and I'd like the editor (or
Im looking to use a document database such as MongoDB but looking through the

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.