I am a beginner to Magento 2 and want to make a sticky sidebar when scrolling down like a cart page summary. I try using jQuery but not working for me. Can anyone help me? https://i.stack.imgur.com/w9L0I.png


Use Magento 2 sticky js for this one. Create custom js in your theme and add the below code. Create a custom JS in your theme:


Add the below code in your theme JS

], function ($) {
    'use strict';
    $(document).ready(function () {
            container: '.columns',
            spacingTop: 100,
            stickyClass: '[sticky-class]'

Note: You can edit spacingTop and stickyClass as per your requirement. I hope it will work for you.

  • thanks for your help its working fine....@Vikram Kumar – Suraj Prajapat Sep 7 '20 at 11:42
  • 1
    My pleasure. Always ready to help. – Vikram Kumar Sep 7 '20 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.