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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:12:25+00:00 2026-06-14T03:12:25+00:00

//NEXT $(‘.social-next a’).on(‘click’, function(e){ e.preventDefault(); $(‘.social’).animate({‘margin-left’: ‘-=940’}, 500); }); //PREVIOUS $(‘.social-previous a’).on(‘click’, function(e){ e.preventDefault();

  • 0
  //NEXT
  $('.social-next a').on('click', function(e){
    e.preventDefault();
    $('.social').animate({'margin-left': '-=940'}, 500);
  });


  //PREVIOUS
  $('.social-previous a').on('click', function(e){
    e.preventDefault();
     $('.social').animate({'margin-left': '+=940'}, 500);
  });

With this code you can just slide forever, out of all the content to where ever, I couldn’t get the buttons to go away, I started getting weird errors. I tried using first and last to juts hide the buttons, but I am not sure where I went wrong and I started trying alternative methods which I am too embarrassed to even mention… I know it’s just a simple 1-2-liner though…

HTML:

    <div class="social">
        <div class="slide">
        <div class="intro">xxx.</div><!-- <a href="#" class="show-slides">view more..</a> -->
        </div>

        <div class="slide">
            <div class="intro">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima error.<a href="#" class="open-slides"></div>
            <div class="content">dolor dolor dolor </div><a href="#" class="close-slides"></a>
        </div>

        <div class="slide">
            <div class="intro">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima error.</div><a href="#" class="open-slides">
            <div class="content">ipsum ipsum ipsum ipsum ipsum</div><a href="#" class="close-slides"></a>
        </div>

        <div class="slide">
            <div class="intro">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima error.<a href="#" class="open-slides"></div>
            <div class="content"><div class="tekst">Lorem Lorem Lorem Lorem Lorem</div></div><a href="#" class="close-slides"></a>
        </div>

    </div>  
  • 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-14T03:12:26+00:00Added an answer on June 14, 2026 at 3:12 am

    There is nothing in that code to give us a first or last position, the only thing that’s being applied is extra margin, so the only way to check position is from the margin.

    For example say on the first slide the margin-left will be 0, you can check for that and hide the previous button, on the last slide the margin will be 2820px, so you can check for that and hide the next button.

    That’s a nasty way of doing it but without changing the markup it’s all that is available to you with this code.

    EDIT – I’ve changed the code to use the callback function of animate, as well as a filter to not allow the animation to start while it is already running, this seems to be working very well and doing exactly what you wanted: I’ve updated the demo so give it a try

    var increment = -94;
    $('.social-next a').on('click', function(e) {
        e.preventDefault();
        $('.social').filter(':not(:animated)').animate({
            'margin-left': '+=' + increment
        }, 500, function() {
            checkButtons($('.social').css("margin-left"))
        });
    });
    
    $('.social-previous a').on('click', function(e) {
        e.preventDefault();
        intMar = +$('.social').css("margin-left").replace("px", "");
        $('.social').filter(':not(:animated)').animate({
            'margin-left': '-=' + increment
        }, 500, function() {
            checkButtons($('.social').css("margin-left"))
        });
    });
    
    function checkButtons(margin) {
        intMar = +margin.replace("px", "");
        var children = $('.social').children('.slide').length;
        var limit = increment * (children - 1);
        switch (intMar) {
        case 0:
            $('.social-previous').hide();
            break;
        case limit:
            $('.social-next').hide();
            break;
        default:
            $('.social-previous').show();
            $('.social-next').show();
            break;
        }
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

}) //NEXT $('.social-next a').on('click', function(e){ e.preventDefault(); $('.social').animate({marginLeft: '-940px'}); }) //PREVIOUS $('.social-previous a').on('click', function(e){ e.preventDefault();
$(next).click(function(event) { event.preventDefault(); if(parseInt($(container).css('left')) <= (-(container_width-offset))) { $(container).animate({ queue:false, left: 0px }, speed, function()
Next question about russian encoding, mssql and python. I have this simple code: import
Have next script: function clicker(){ var linkId = [id*= + link]; var butnId='initial'; $j(linkId).click(function(){
next.onclick = function() { move('left', li_items[0]); }; var move = function(direction, el) { pos
Why next code is valid Javascript code? var global = (1,eval)('this'); alert(global);
Next code worked in Jquery 1.5.1, but in Jquery 1.8.0 this code not worked,
**the next code should parse a data from a webService to textView; Problem :
The next code runs normally in SQLSERVER but when i change the web.config to
I have next code, <form id=form1 runat=server> <asp:Label runat=server ID=Label1 EnableViewState=false /> <asp:CheckBox runat=server

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.