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

  • Home
  • SEARCH
  • 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 7521039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:10:08+00:00 2026-05-30T02:10:08+00:00

im creating a slider body but got a problem. I have a next previous

  • 0

im creating a slider body but got a problem. I have a next previous “button” that will slide forward and backward. When this buttons is clicked it will removed the class that make it to do the animation to forward and backward, but when i remove the class, the animation is still working. why?

making the stuff:

    esq = 0;

    var navR,navL   = false;

$(".caixa_pequena").each(function(){
    var $element = $(this).css('left'); 
    final = parseFloat($element) + parseFloat(esq); 

    $(this).css('left', parseFloat(final) + 'px');
    esq = esq  + 200;   
});

the forward button:

$('.nav_depois').click(function(){
    desactEsq();
    desactDir();
    var nr = $(".caixa_pequena").size()-1;
    var total = (nr * (parseInt(-200)))+ parseInt($(".caixa_pequena").css('left')) + 'px';
    var m = $(".caixa_pequena").offset().left+'px'; 


    if(total != m){
        $("#texto").animate({left: '-=200'}, 'slow', function(){
            /*actEsq();
            actDir();*/
        }); 
    }   
});

the backward button

$('.nav_antes').click(function(){
    desactEsq();
    desactDir();
   var l = $(".caixa_pequena").offset().left+'px';
    if(l != $(".caixa_pequena").css('left')){  
       $("#texto").animate({left: '+=200'}, 'slow', function(){
        /*actEsq();
        actDir();*/    
       });
    }       
});

the active/desactivate

function desactDir () {
    navR = false;
    $('#nav_panel').find('.nav_depois').removeClass();
}
function desactEsq () {
    navL = false;
    $('#nav_panel').find('.nav_antes').removeClass();
}
function actDir () {
    navR = true;
    $('#nav_panel').find('#nav_next').addClass('nav_depois');
}
function actEsq () {
    navL = true;
    $('#nav_panel').find('#nav_prev').addClass('nav_antes');
}
});

the html

<div id="caixa_grande">
<div id="texto">    
    <div class="caixa_pequena">SPORT LISBOA E BENFICA</div>
    <div class="caixa_pequena">SPORTING CLUBE DE PORTUGAL</div>
    <div class="caixa_pequena">FUTEBOL CLUBE DOS COXOS</div>
</div>  
</div>
<div id="nav_panel">
    <a id="nav_next" class="nav_antes"><-------|</a>
    <a id="nav_prev" class="nav_depois">|--------></a>
</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-05-30T02:10:09+00:00Added an answer on May 30, 2026 at 2:10 am

    The click method is binded to the element, when you do

    $('.nav_depois').click(function(){
    //code...
    });
    

    jQuery will search for every element with a class of nav_depois and set the function you passed so it will be executed when a click occurs.

    To be more clear it’s binding the event, so

    jQuery("element").click(f);
    

    translates to

    jQuery("element").bind("click", f);
    

    To remove the method you should use unbind (or off if you’re using jQuery 1.7), for example

    function desactDir () {
        navR = false;
        $('#nav_panel').find('.nav_depois').unbind("click");
    }
    

    and to reattach it you should bind it again (with the click or bind methods), to do that I recommend storing the function and passing it as a parameter like:

    var navAntesFunction = function (){
    //code
    }
    
    $('.nav_antes').click(navAntesFunction);
    
    function actEsq () {
        navL = true;
        $('#nav_panel').find('#nav_prev').click(navAntesFunction);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a new slider that will integrate with my self written Javascript library.
I have this form Im creating and when you click on the Next button
Recently, I have been trying to accomplish creating a full-width jQuery slider that would
I am creating a simple slide show. I have done everything, but am struggling
I am creating a portfolio page for m personal site. I have a slider
I am creating a portfolio page for m personal site. I have a slider
I have custom slider that I use the following touch event to respond to:
This will be my first time creating one of those slider things. I've seen
This might be a little confusing. I'm creating this slider thing. When a slide
I have a short audio clip that plays when a button is pressed. I

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.