0

I am setting up a small shop using simpleCart.js and Bootstrap 3. For displaying the cart I was hoping to use an off-canvas panel that I have enabled using the Jasny-bootstrap add-on. Everything works fine but when I eliminate elements from the cart the off-canvas panel closes. This way the user his unable to modify content in the cart without having to reopen the panel after each click. How can I keep the panel open until the user chooses to close it?

Here is an FIDDLE demonstrating the issue

From looking at this snippet from (link straight to code) simpleCart.js - line 337-353, am I right in assuming that once you remove an item it reloads the cart and therefore it causes the panel to close? If this is the case, then how would a version of this code look like to fix my problem?

                // empty the cart
            empty: function () {
                // remove each item individually so we see the remove events
                var newItems = {};
                simpleCart.each(function (item) {
                    // send a param of true to make sure it doesn't
                    // update after every removal
                    // keep the item if the function returns false,
                    // because we know it has been prevented 
                    // from being removed
                    if (item.remove(true) === false) {
                        newItems[item.id()] = item
                    }
                });
                sc_items = newItems;
                simpleCart.update();
            },

Thank you in advance :)

Arnold Daniels
  • 16,516
  • 4
  • 53
  • 82
no0ne
  • 2,659
  • 8
  • 28
  • 44

1 Answers1

1

The option autohide controls if the navbar should be closed when a user clicks outside of it. Setting it to false, means it stays open until the user clicks on the 'CLOSE PANEL HERE' link.

See the fiddle

Note that normally the navmenu doesn't close when clicked on a link inside of it. I'm not sure why this is happening in your case.

Arnold Daniels
  • 16,516
  • 4
  • 53
  • 82
  • Thank you for the ultra clear answer.. and thank you for your wonderful bootstrap add-on :) – no0ne Apr 12 '14 at 02:11