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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:27:22+00:00 2026-06-14T04:27:22+00:00

Sorry for my not very clear title. I was wandering if someone could help

  • 0

Sorry for my not very clear title. I was wandering if someone could help me. I am making a game and I want to make an array holding a number (tells you how much something is worth in credits) and also there is an image (to show the thing you are buying). I am putting all of these arrays into a slider so players can see the different items they can buy and here is what I have done so far. The website of my project is: theassets.staticloud.com
This is just something I knocked up to show you the basic idea of what I am doing:

<html>
<head>
     <title>Test</title>
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
     <script type="text/javascript">
var island = new Array();
island[0] = 7000;
island[1] = $islandimg;
     </script>
     </head>
     <body>
          <img src="http://avatarmaker.net/free-avatars/avatars/nature_217/scenery_275/moorea_island_avatar_100x100_83622.jpg" id="islandimg">
          <body>

</html>

This is what I am working on:

<!doctype html>

<html lang="en">
<body bgcolor="black">
<head>
    <meta charset="utf-8" />
    <title>jQuery UI Slider - Slider scrollbar</title>
<center>
<img src="theassetsimg.png">
<br />
<br />
<center><table>
<tr><td><img src="cooltext819230394.png" onmouseover="this.src='cooltext819230394MouseOver.png';" onmouseout="this.src='cooltext819230394.png';" /></td>
<td><img src="cooltext819231213.png" onmouseover="this.src='cooltext819231213MouseOver.png';" onmouseout="this.src='cooltext819231213.png';" /><a></td>
<td><img src="cooltext819232096.png" onmouseover="this.src='cooltext819232096MouseOver.png';" onmouseout="this.src='cooltext819232096.png';" /><a></td></tr>
</table></center>
</center>    
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <style>
    .scroll-pane { overflow: auto; width: 99%; float:left; }
    .scroll-content { width: 2440px; float: left; }
    .scroll-content-item { width: 100px; height: 100px; float: left; margin: 10px; font-size: 3em; line-height: 96px; text-align: center; }
    * html .scroll-content-item { display: inline; } /* IE6 float double margin bug */
    .scroll-bar-wrap { clear: left; padding: 0 4px 0 2px; margin: 0 -1px -1px -1px; }
    .scroll-bar-wrap .ui-slider { background: none; border:0; height: 2em; margin: 0 auto;  }
    .scroll-bar-wrap .ui-handle-helper-parent { position: relative; width: 100%; height: 100%; margin: 0 auto; }
    .scroll-bar-wrap .ui-slider-handle { top:.2em; height: 1.5em; }
    .scroll-bar-wrap .ui-slider-handle .ui-icon { margin: -8px auto 0; position: relative; top: 50%; }
    </style>
    <script>
    $(function() {
        //scrollpane parts
        var scrollPane = $( ".scroll-pane" ),
            scrollContent = $( ".scroll-content" );

        //build slider
        var scrollbar = $( ".scroll-bar" ).slider({
            slide: function( event, ui ) {
                if ( scrollContent.width() > scrollPane.width() ) {
                    scrollContent.css( "margin-left", Math.round(
                        ui.value / 100 * ( scrollPane.width() - scrollContent.width() )
                    ) + "px" );
                } else {
                    scrollContent.css( "margin-left", 0 );
                }
            }
        });

        //append icon to handle
        var handleHelper = scrollbar.find( ".ui-slider-handle" )
        .mousedown(function() {
            scrollbar.width( handleHelper.width() );
        })
        .mouseup(function() {
            scrollbar.width( "100%" );
        })
        .append( "<span class='ui-icon ui-icon-grip-dotted-vertical'></span>" )
        .wrap( "<div class='ui-handle-helper-parent'></div>" ).parent();

        //change overflow to hidden now that slider handles the scrolling
        scrollPane.css( "overflow", "hidden" );

        //size scrollbar and handle proportionally to scroll distance
        function sizeScrollbar() {
            var remainder = scrollContent.width() - scrollPane.width();
            var proportion = remainder / scrollContent.width();
            var handleSize = scrollPane.width() - ( proportion * scrollPane.width() );
            scrollbar.find( ".ui-slider-handle" ).css({
                width: handleSize,
                "margin-left": -handleSize / 2
            });
            handleHelper.width( "" ).width( scrollbar.width() - handleSize );
        }

        //reset slider value based on scroll content position
        function resetValue() {
            var remainder = scrollPane.width() - scrollContent.width();
            var leftVal = scrollContent.css( "margin-left" ) === "auto" ? 0 :
                parseInt( scrollContent.css( "margin-left" ) );
            var percentage = Math.round( leftVal / remainder * 100 );
            scrollbar.slider( "value", percentage );
        }

        //if the slider is 100% and window gets larger, reveal content
        function reflowContent() {
                var showing = scrollContent.width() + parseInt( scrollContent.css( "margin-left" ), 10 );
                var gap = scrollPane.width() - showing;
                if ( gap > 0 ) {
                    scrollContent.css( "margin-left", parseInt( scrollContent.css( "margin-left" ), 10 ) + gap );
                }
        }

        //change handle position on window resize
        $( window ).resize(function() {
            resetValue();
            sizeScrollbar();
            reflowContent();
        });
        //init scrollbar size
        setTimeout( sizeScrollbar, 10 );//safari wants a timeout
    });
    </script>
</head>
<body>

<div class="scroll-pane ui-widget ui-widget-header ui-corner-all">
    <div class="scroll-content">
        <div class="scroll-content-item ui-widget-header"><img src="http://avatarmaker.net/free-avatars/avatars/nature_217/scenery_275/moorea_island_avatar_100x100_83622.jpg" id=""></div>
        <div class="scroll-content-item ui-widget-header"><img src="http://i31.twenga.com/jewellery/watch/nixon-watches-all-gold-tp_531465411970057721.jpg"></div>
        <div class="scroll-content-item ui-widget-header"><img src="http://www.glitteringstones.com/Images/bluediamond.gif"></div>
        <div class="scroll-content-item ui-widget-header"><img src="http://www.rac.co.uk/images/tiles/car-driving.aspx"></div>
    </div>
    <div class="scroll-bar-wrap ui-widget-content ui-corner-bottom">
        <div class="scroll-bar"></div>
    </div>
</div>


</body>
</html>
  • 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-14T04:27:23+00:00Added an answer on June 14, 2026 at 4:27 am

    You may need to create an array of objects

    var items = [];
    
    items.push({
      name: 'Island',
      worth: 7000,
      image: 'http://../island.jpg'
    });
    
    items.push({
      name: 'Watch',
      worth: 100,
      image: 'http://../watch.jpg'
    });
    

    Then you could iterate over the items array and access the required properties

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

Sidebar

Related Questions

Sorry the title is not very clear. This is a follow up to my
Sorry the title may not be very clear. Basically I have a wrapper for
Sorry about the title to this question, it's not very clear but wasn't sure
sorry if the title is not very clear. I will try to explain now:
Sorry if the title is not very clear. I was not sure about the
Sorry, that's not a very clear title. Here's what I've got: SELECT u.name FROM
Sorry for the title, perhaps it's not very clear. I have some SQL queries
Sorry for a long question and not a very descriptive title, but my problem
I could be not more sorry guys - the question was a very wrong
sorry if the title is very confusing, but I'm not sure how to really

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.