rabihkodeih / bootstrap-transfer

This is a two-column transfer multi-select widget inspired by Django admin module's similar widget.
Other
45 stars 46 forks source link

Jumps to the top of the page #1

Open cdeyoung opened 12 years ago

cdeyoung commented 12 years ago

If the bootstrap-transfer widget is included down far enough on the page that you have to scroll to see it, the page will jump back to the top whenever you move data from one column to the other. To fix the problem, you can add "return false; to the following functions:

        _this.$add_btn.click(function(){
            _this.move_elems(_this.$remaining_select.val(), false, true);
            return false;   <--  Add "return false;" to the function to keep the page from jumping back to the top"
        });
        _this.$remove_btn.click(function(){
            _this.move_elems(_this.$target_select.val(), true, false);
            return false;
        });
        _this.$choose_all_btn.click(function(){
            _this.move_all(false, true);
            return false;
        });
        _this.$clear_all_btn.click(function(){
            _this.move_all(true, false);
            return false;
        });
        _this.$filter_input.keyup(function(){
            _this.update_lists(true);
            return false;
        });

Thanks for the great plugin, by the way! It looks beautiful.

mariela21180 commented 10 years ago

Other solution is that on the .js file, on every <a href="#"> element, replace the "#" to "javascript:void(0);" So It looks like this: <a href="javascript:void(0);">