WeCodePixels / theia-sticky-sidebar

Glues your website's sidebars, making them permanently visible while scrolling.
MIT License
569 stars 209 forks source link

Realtime enable and disable #31

Open timemrah opened 7 years ago

timemrah commented 7 years ago

Is it possible to enable or disable this plugin at any time with JavaScript?

$(document).ready(function(){

    $('#item-id').theiaStickySidebar();

    if ('any time') {
        $('#item-id').theiaStickySidebar(false); //is this posible?
    }
    if ('any more time') {
        $('#item-id').theiaStickySidebar(true); //is this posible?
    }
});
liviucmg commented 7 years ago

Not at this moment, no. Also, how would disabling it work? Would it simply snap the sidebar back to its original position? Or would it keep its current position, but stop from changing it any further?

timemrah commented 7 years ago

The columns of our website can change dynamically. Because the content changes dynamically. For example, the columns of our site fall from two to three.

We are activating the plug-in for all of our columns. We get very good results. But when we drop the column count dynamically from three to two, the columns are climbing over.

<!-- COLUMN PATTERN-1 -->
<div class="row">
    <div class="col-md-6">
        <!-- AREA-1 -->
    </div>
    <div class="col-md-6">
        <div class="col-md-6">
            <!-- AREA-2 -->
        </div>
        <div class="col-md-6">
            <!-- AREA-3 -->
        </div>
    </div>
</div>

<!-- COLUMN PATTERN-2 -->
<div class="row">
    <div class="col-md-6">
        <!-- AREA-1 -->
    </div>
    <div class="col-md-6">
        <div class="col-md-12">
            <!-- AREA-2 -->
        </div>
        <div class="col-md-12">
            <!-- AREA-3 -->
        </div>
    </div>
</div>
liviucmg commented 7 years ago

This is now possible with version 1.7.0: https://github.com/WeCodePixels/theia-sticky-sidebar/pull/41#issuecomment-296819272

Question is: should this destroy functionality be bundled inside the library?