unsticky

usmanadnan001 pro asked 7 years ago

how can i unstick an element?

Mirosław Stasiak commented 7 years ago

What element do you want to unstick? Tell me more details.

usmanadnan001 pro commented 7 years ago

stickycontent

You can do it in two ways:

//It stops after a certain number of pixels 'stopper'
$("#header").sticky({ 
  zIndex:3, 
  stopper: 300 
});
//stopper is an element which stop the StickyContent. 
$(".sticky").sticky({ 
  topSpacing: 58, 
  zIndex:2, 
  stopper: "#footer" 
});

usmanadnan001 pro commented 7 years ago

i want to unstick the element after an ajax call (not scrolling)

If you want to unstick element after the ajax response, just in the done function you can remove from this element class '.sticky' and add a stopper.
But after this, you need to scroll page to see effect

      $.ajax({
        url        : '/url',
        method     : 'POST',
        dataType   : 'json',
        contentType: 'application/json',
        data       : JSON.stringify(data)
      }).done(function(response){
        $("#sticky-element").sticky({
                stopper: 0
            });
        $('#sticky-element').removeClass();
      }

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No