How to use the perfect-scrollbar.update function in perfect-scrollbar

To help you get started, we’ve selected a few perfect-scrollbar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / perfect-scrollbar / perfect-scrollbar-tests.ts View on Github external
// It can be initialised with optional parameters.
Ps.initialize(container, {
  wheelSpeed: 2,
  wheelPropagation: true,
  minScrollbarLength: 20
})

// If the size of your container or content changes, call `update`.
Ps.update(container)

// If you want to destroy the scrollbar, use `destroy`.
Ps.destroy(container)

// If you want to scroll to somewhere, just use a `scrollTop` property and update.
container.scrollTop = 0
Ps.update(container)

/**
 * https://github.com/noraesae/perfect-scrollbar#jquery
 */

import mountJQuery = require('perfect-scrollbar/jquery')
mountJQuery($)

$('#container').perfectScrollbar()            // Initialize
$('#container').perfectScrollbar({ /*...*/ }) // with options
$('#container').perfectScrollbar('update')    // Update
$('#container').perfectScrollbar('destroy')   // Destroy
github peerplays-network / BookiePro / src / components / Exchange / Exchange.jsx View on Github external
componentDidUpdate(prevProps, prevState) {
    //reset scroll area in sidebar and betting widget upon route change.
    Ps.update(this.refs.sidebar);
    Ps.update(this.refs.main);

    // navigate to new route after clicking confirm button in confirmation modal.
    if (prevState.confirmToLeave === false && this.state.confirmToLeave === true) {
      this.props.navigateTo(this.state.nextLocation);
      this.setState({
        confirmToLeave: false
      });
    }
  }
github bitshares / bitshares-ui / app / components / Exchange / MarketHistory.jsx View on Github external
_changeTab(tab) {
        SettingsActions.changeViewSetting({
            historyTab: tab
        });
        this.setState({
            activeTab: tab
        });

        // Ensure that focus goes back to top of scrollable container when tab is changed
        let historyNode = this.refs.history;
        historyNode.scrollTop = 0;
        Ps.update(historyNode);

        setTimeout(ReactTooltip.rebuild, 1000);
    }
github gxchain / gxchain-light / web / app / components / Account / RecentTransactions.jsx View on Github external
const nodes = csv_export_container.childNodes;
            let csv = "";
            for (const n of nodes) {
                //console.log("-- RecentTransactions._downloadCSV -->", n);
                const cn = n.childNodes;
                if (csv !== "") csv += "\n";
                csv += [textContent(cn[0]), textContent(cn[1]), textContent(cn[2]), textContent(cn[3])].join(",");
            }
            var blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
            var today = new Date();
            saveAs(blob, "gxbhist-" + today.getFullYear() + "-" + today.getMonth() + "-" + today.getDate() + ".csv");
        }

        if (!this.props.fullHeight) {
            let t = this.refs.transactions;
            ps.update(t);

            this._setHeaderHeight();

        }

    }
github bitshares / bitshares-ui / app / components / Exchange / OrderBook.jsx View on Github external
psUpdate() {
        if (!this.props.horizontal) {
            Ps.update(this.verticalScrollBar());
        } else {
            let bidsContainer = this.refs.hor_bids;
            Ps.update(bidsContainer);
            let asksContainer = this.refs.hor_asks;
            Ps.update(asksContainer);
        }
    }
github bitshares / bitshares-ui / app / components / Exchange / MarketHistory.jsx View on Github external
if (
            nextProps.hideScrollbars !== this.props.hideScrollbars &&
            nextProps.hideScrollbars
        ) {
            Ps.destroy(historyContainer);
        }

        if (
            nextProps.hideScrollbars !== this.props.hideScrollbars &&
            !nextProps.hideScrollbars
        ) {
            Ps.initialize(historyContainer);
            this.refs.historyTransition.resetAnimation();
            if (historyContainer) historyContainer.scrollTop = 0;
            Ps.update(historyContainer);
        }
    }
github bitshares / bitshares-ui / app / components / Exchange / OrderBook.jsx View on Github external
psUpdate() {
        if (!this.props.horizontal) {
            Ps.update(this.verticalScrollBar());
        } else {
            let bidsContainer = this.refs.hor_bids;
            Ps.update(bidsContainer);
            let asksContainer = this.refs.hor_asks;
            Ps.update(asksContainer);
        }
    }
github bitshares / bitshares-ui / app / components / Exchange / OrderBook.jsx View on Github external
psUpdate() {
        if (!this.props.horizontal) {
            Ps.update(this.verticalScrollBar());
        } else {
            let bidsContainer = this.refs.hor_bids;
            Ps.update(bidsContainer);
            let asksContainer = this.refs.hor_asks;
            Ps.update(asksContainer);
        }
    }
github peerplays-network / BookiePro / src / components / BettingDrawers / QuickBetDrawer / QuickBetDrawer.jsx View on Github external
componentDidUpdate(prevProps) {
    Ps.update(ReactDOM.findDOMNode(this.refs.bettingtable));
    
    if (prevProps.betsError[0] !== this.props.betsError[0]) {
      this.addRemoveMessage();
    }

  }
github bitshares / bitshares-ui / app / components / Exchange / MyOpenOrders.jsx View on Github external
shouldComponentUpdate(nextProps, nextState) {
        if (nextProps.activeTab !== this.state.activeTab) {
            this._changeTab(nextProps.activeTab);
        }

        if (
            this.props.hideScrollbars &&
            nextState.showAll != this.state.showAll
        ) {
            let contentContainer = this.refs.container;
            if (!nextState.showAll) {
                Ps.destroy(contentContainer);
            } else {
                Ps.initialize(contentContainer);
                Ps.update(contentContainer);
            }
            if (this.refs.contentTransition) {
                this.refs.contentTransition.resetAnimation();
            }
            if (contentContainer) contentContainer.scrollTop = 0;
        }

        return (
            nextProps.baseSymbol !== this.props.baseSymbol ||
            nextProps.quoteSymbol !== this.props.quoteSymbol ||
            nextProps.className !== this.props.className ||
            nextProps.activeTab !== this.props.activeTab ||
            nextState.activeTab !== this.state.activeTab ||
            nextState.showAll !== this.state.showAll ||
            nextProps.currentAccount !== this.props.currentAccount
        );