jellekralt / Responsive-Tabs

Responsive Tabs is a jQuery plugin that provides responsive tab functionality. The tabs transform to an accordion when it reaches a CSS breakpoint. You can use this plugin as a solution for displaying tabs elegantly on desktop, tablet and mobile.
http://jellekralt.github.io/Responsive-Tabs/
MIT License
531 stars 228 forks source link

Question: How to Deactivate and Reactivate Responsive Tabs #141

Closed HoomanBahreini closed 6 years ago

HoomanBahreini commented 6 years ago

Hi, this is the first time I am using Github and this is just an a question, not an issue, so apologies if I am not using the correct process for asking a question.

Firstly thanks a lot for developing Jquery.ResponsiveTabs, great product.

I have developed my menu items using responsive Tabs. I want them to open/close on mouseover, when the screen size is large (this works fine).

When I reduce the screen size, I want to deactivate mouseover event, as I will be opening/closing the menu items, by clicking on a specific button. And I am not sure how do deactivate the mouseover event... at the same time I want to reactivate the mouseover event, if the screen is resized to large.

I have asked this question on stackoverflow and not a single answer/comment:

This is how I Initialize responsive Tabs:

JQuery(document).ready(function ($) {
"use strict";

TabsResponsive();
/*==========  Tabs Responsive ==========*/
function TabsResponsive() {
    if ($('#tabs-responsive').length) {
        $('#tabs-responsive').responsiveTabs({
            rotate: false,
            active: 0,
            event: 'mouseover',
            startCollapsed: 'accordion',
            collapsible: 'accordion',
            animation: 'slide',
            duration: 300,
            setHash: false
        });
    }
}

I want to deactivate the mouse over event, so on screen resize, I do:

if (Modernizr.mq('(max-width: 991px)')) {  
    $('a.r-tabs-anchor').off('mouseover');
}

This will correctly deactivate the event, but I do not know how to turn it back on?

I tried calling TabsResponsive() again to reinitialize the object but it did not work.

Appreciate your help in advance, Hooman

jellekralt commented 6 years ago

Hi there, Unfortunately, this is not something I can help you with. This is a very specific issue for which I don't have the time to debug, sorry!