0

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

1 Answer 1

1

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/

Sign up to request clarification or add additional context in comments.

1 Comment

thank you for the answer. I'm not sure if unbin() or off() is what I need. For example, when the page load, the 3D viewer load. If I display none on page load, when I click on 3D toggle button it doesn't appear because I need to load the 3D viewer script. I want to load the script and to unload the script on click button.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.