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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:34:15+00:00 2026-06-07T21:34:15+00:00

This is the html part of the sliders navigation: <div id=button> <a class=button1 active

  • 0

This is the html part of the sliders navigation:

<div id="button">
     <a class="button1 active" rel="1" href="#"></a>
     <a class="button2" rel="2" href="#"></a>
     <a class="button3" rel="3" href="#"></a>
</div>

This is the complete jQuery code for the slider:

$(document).ready(function (){
  $('#button a').click(function(){
    var integer = $(this).attr('rel');
    /*----- Width of div mystuff (here 160) ------ */
    $('#myslide .cover').animate({left:-160*(parseInt(integer)-1)})
    $('#button a').each(function(){
      $(this).removeClass('active');
      if($(this).hasClass('button'+integer)){
        $(this).addClass('active')
      }
    });
  });   
});

i am building a content slider for an assignment on college and I am having trouble following this code.

You can find the complete code for this slider here.

Our 3 links have rel attributes with values 1,2 and 3. This line of jQuery calculates how much will the slider slide:

$('#myslide .cover').animate({left:-160*(parseInt(integer)-1)})

So if the variable integer is 1 it will be -160*(1-1)=0 – the slider doesn’t move
if its 2 the result will be -160 and it will move to the right for 160px.
And if its 3 it will move to the right for 320px.

How does this code moves the slide to the left?
It works if you test the demo on the page, but I don’t understand how?
Can someone explain it to me please?

  • 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-07T21:34:16+00:00Added an answer on June 7, 2026 at 9:34 pm

    Negative left values will cause the element to move to the left of the 0 position. When you animate from 0 to -160, it will move left.

    http://jsfiddle.net/vrRfu/

    Am I misunderstanding the question?

    enter image description here

    A positive integer multiplied by -160 results in a negative left position causing the element to move left.

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

Sidebar

Related Questions

Given this html: <div class=nation> <a href=library.php?type=nation&amp;id=America> <div class=nation-image> <img src=nations/America.png alt=snip /> </div>
Given this HTML: <div id=foo> <input type=button class=foo abtn_1> <input type=button class=joe bbtn_2> <input
Given this HTML: <div id=foo> <input type=button class=foo abtn_1> <input type=button class=joe bbtn_2> <input
I have this html: <div class=portlet-header> Company Information ... <button> some button here </button>
I have something like this: //html <div class=panel> <div class=tools> <a href=#action1>Action 1</a> <a
this is html part <!-- html part --> <ul id=accordion> <li> <a href=# class=item
This is the HTML part: div id=messages> <div class=messages> <?php if(isset ($unread)) { ?>
Is this html <div class='title centered'>SCE</div> <div class='description'> Magna tristique pulvinar porta montes, scelerisque
Given this HTML: <div class=OpenIDSelector>some text</div> Why does this JQuery selector match it on
I have this html <form method=POST action= id=order class=forms> <div> <span class=col1>Ref.</span> <span class=col2>Number</span>

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.