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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:20:16+00:00 2026-06-12T15:20:16+00:00

I am using a jquery slot machine plugin and want to expand a bit,

  • 0

I am using a jquery slot machine plugin and want to expand a bit, but am having trouble figuring out how it is working.

https://github.com/matthewlein/jQuery-jSlots

Currently, the demo uses it in a way that only one <li> is showing at a time. I want to expand that, so that you can see half of the the <li> above and half of the <li> below, kind of like a real slot machine, where you can see what is coming and what is leaving the visible area.

So, I expanded the container vertically, and I can see the <li>‘s before and after BUT, weird things happen at the bottom, where the <li> disappears and then (I assume) gets appended to the top. It still happens if I make it 5+ <li>‘s in the list. It also still happens if I increase the .slot size, but still constrain it with a shorter container height.

You will notice on this fiddle, when you click play, you will see the white background show through on the bottom. It gets worse as they slow down. Sometimes when they stop, it stops with the bottom part missing… I have attached the jslots.js file in the fiddle resources

http://jsfiddle.net/livinzlife/3bVe9/1/

  • 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-12T15:20:17+00:00Added an answer on June 12, 2026 at 3:20 pm

    Add the following to the CSS for the li elements:

    margin-top: 72px;     /*half of the height */
    margin-bottom: -72px; /*half of the height (negative)*/
    

    so .slot li becomes:

    .slot li{
        width: 190px;
        height: 144px;
        background-color: blue;
        float: left;
        margin-top: 72px;     /*half of the height */
        margin-bottom: -72px; /*half of the height (negative)*/
    }
    

    UPDATE:

    To eliminate the background-color problem, add background-color: yellow; to the jSlots-wrapper class:

    .jSlots-wrapper {  
        overflow: hidden; /* to hide the magic */  
        height: 296px; /* whatever the height of your list items are */  
        display: inline-block; /* to size width correctly, can use float too, or width*/  
        border: 1px solid #999;  
        position: absolute;
        width:570px;
        /*bottom: 130px;*/
        margin-top: 2em;
        left:50%;
        margin-left: -285px;
        padding: 0;
        background-color: yellow;
    }
    

    UPDATE:

    The principle of background-color holds true for images as well. Just set the background-image of the .jSlots-wrapper class to the image you’re using for for the last li element and offset it vertically by (negative) half the li height

    Updated fiddle: http://jsfiddle.net/3bVe9/6/ for proof-of-concept (using images obtained by GIS for “random image” of size 256×256)

    UPDATE:

    Okay, change the CSS definition for .slot li from:

    margin-top: 72px;     /*half of the height */
    margin-bottom: -72px; /*half of the height (negative)*/
    

    to:

    margin-top: -72px;     /*half of the height (negative) */
    margin-bottom: 72px;   /*half of the height*/
    

    so .slot li becomes:

    .slot li{
        width: 190px;
        height: 144px;
        margin-top: -72px;     /*half of the height (negative) */
        margin-bottom: 72px;   /*half of the height*/
        background-color: blue;
        float: left;
        background-size: 190px 144px;
    }
    

    and revert the CSS changes to the .jSlots-wrapper class definition and the problem is completely fixed (for both colors and images, here’s another fiddle: http://jsfiddle.net/3bVe9/7/

    This adjusts the slots so that the first li is offset upwards and the second li is the middle starting spot. Works perfectly on every click of the play button.

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

Sidebar

Related Questions

Using jQuery validation plugin but it has no CSV validation. I have made an
Using jQuery timepickr: http://archive.plugins.jquery.com/project/jquery-timepickr Having included these files: jquery-1.7.1.min.js jquery-ui-1.8.21.custom.min.js ui.timepickr.js And getting this
Using jQuery I'm trying to obtain the rotation state of an object but in
(using jquery) I have the following function $(function() { $('tr.parent') .css(cursor,pointer) .attr(title,Click to expand/collapse)
Using jQuery validation plugin - http://docs.jquery.com/Plugins/Validation Wanting to use the remote method on a
Using jQuery, one can easily find out whether a particular element is visible using
Using jquery, How can I create multiple draggables using loops through javascript? I want
Using jQuery I'd like to add additional top-margin to a div 'foo', but only
Using jQuery, I am referencing a particular ID and then I want to add
Using jquery, I want to post data to from one of my pages 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.