jQuery noConflict()不使用multiselect和daterangepicker

时间:2018-02-05 19:08:54

标签: javascript jquery html twitter-bootstrap

我是jQuery的新手,遇到问题,我尝试在一个页面上创建日历和多选下拉列表,但我有问题他们使用不同的js库并且它们相互冲突。尝试使用noConflict,但它没有帮助,或者我用错了.Scripts本身工作正常。但是当我试图团结它们时,多选择停止工作。我不知道该怎么做。我将非常感谢任何帮助。

它的照片是如何工作的,因为你可以看到multiselect工作不正常。 https://imgur.com/a/aQJfz

var doc = window.document,
                context = doc.querySelector('.js-loop'),
                clones = context.querySelectorAll('.is-clone'),
                disableScroll = false,
                scrollHeight = 0,
                scrollPos = 0,
                clonesHeight = 0,
                i = 0;

            function getScrollPos () {
                return (context.pageYOffset || context.scrollTop) - (context.clientTop || 0);
            }

            function setScrollPos (pos) {
                context.scrollTop = pos;
            }

            function getClonesHeight () {
                clonesHeight = 0;

                for (i = 0; i < clones.length; i += 1) {
                  clonesHeight = clonesHeight + clones[i].offsetHeight;
                }

                return clonesHeight;
            }

            function reCalc () {
                scrollPos = getScrollPos();
                scrollHeight = context.scrollHeight;
                clonesHeight = getClonesHeight();

                if (scrollPos <= 0) {
                  setScrollPos(1); // Scroll 1 pixel to allow upwards scrolling
                }
            }

            function scrollUpdate () {
                if (!disableScroll) {
                  scrollPos = getScrollPos();

                if (clonesHeight + scrollPos >= scrollHeight) {
                    // Scroll to the top when you’ve reached the bottom
                    setScrollPos(1); // Scroll down 1 pixel to allow upwards scrolling
                    disableScroll = true;
                } else if (scrollPos <= 0) {
                    // Scroll to the bottom when you reach the top
                    setScrollPos(scrollHeight - clonesHeight);
                    disableScroll = true;
                }
            }

                if (disableScroll) {
                    // Disable scroll-jumping for a short time to avoid flickering
                    window.setTimeout(function () {
                      disableScroll = false;
                    }, 40);
                }
            }

                window.requestAnimationFrame(reCalc);

                context.addEventListener('scroll', function () {
                    window.requestAnimationFrame(scrollUpdate);
                }, false);

                window.addEventListener('resize', function () {
                    window.requestAnimationFrame(reCalc);
                }, false);

本课我曾经创建过多选jquery列表。

http://www.webslesson.info/2017/05/bootstrap-multi-select-dropdown-with-checkboxes-using-jquery-in-php.html

我曾经创建过daterangepicker http://www.daterangepicker.com

0 个答案:

没有答案