lolo
lolo

Reputation: 237

Enable disable jquery script onclick

I want to switch between differents jquery plugin: to desactive (disable) one when an other is activated (enable).

I have an html page where there are a touchslider (github.com/iosscripts/iosSlider) and a 3D viewer (github.com/creativeaura/threesixty-slider).

I want to switch, thanks to a button, between the 2D view (iosslider) and the 3D view (three sixty slider). I want only one enabled at a time.

I created a fiddle (the 3D viewer don't work, I don't know why): http://fiddle.jshell.net/TL72w/1/

Here is my website, where the 2D and 3D views works fine but have some conflicts (because they are activated at the same times) : http://freakyshape.com/

this is the script that display: none the 2D and 3D viewer (I want to add enable disable jquery viewer):

$(document).ready(function() {
   $("a.on.tggl").click(function() {
    $(this).addClass("active");
    $(this).next(".tggl").removeClass("active");
    $('.container-iosSlider').css('display', 'block');
    $('.360-viewer').css('display', 'none');
    $('.custom_nav_bar').css('display', 'none');
    return false;
  });
  $("a.off.tggl").click(function() {
    $(this).addClass("active");
    $(this).prev(".tggl").removeClass("active");
    $('.container-iosSlider').css('display', 'none');
    $('.360-viewer').css('display', 'block');
    $('.custom_nav_bar').css('display', 'block');
    return false;
  });
  $("a.on.pshbtn").click(function() {
    $(this).addClass("active");
    $("a.off.pshbtn").removeClass("active");
    return false;
  });
  $("a.off.pshbtn").click(function() {
    $(this).addClass("active");
    $("a.on.pshbtn").removeClass("active");
    return false;
  });  
 });

Sorry for English, I'm french

Upvotes: 0

Views: 1003

Answers (1)

isherwood
isherwood

Reputation: 61063

You probably want to unbind: http://api.jquery.com/unbind/

If you were using on(), you could also use off(): http://api.jquery.com/off/

Upvotes: 1

Related Questions