Arthur Shan
Arthur Shan

Reputation: 11

how to use jquery plugin in framework7

the plugin is http://www.jsplugins.net/jquery-seat-charts-plugin/ the code are as follows,I use it in f7,but it says" Uncaught TypeError: $$(...).seatCharts is not a function" i have already change $ to $$. $(document).ready(function() {

var sc = $('#seat-map').seatCharts({
    map: [
        'aaaaaaaaaaaa',
        'aaaaaaaaaaaa',
        'bbbbbbbbbb__',
        'bbbbbbbbbb__',
        'bbbbbbbbbbbb',
        'cccccccccccc'
    ],
    seats: {
        a: {
            price   : 99.99,
            classes : 'front-seat' //your custom CSS class
        }

    },
    click: function () {
        if (this.status() == 'available') {
            //do some stuff, i.e. add to the cart
            return 'selected';
        } else if (this.status() == 'selected') {
            //seat has been vacated
            return 'available';
        } else if (this.status() == 'unavailable') {
            //seat has been already booked
            return 'unavailable';
        } else {
            return this.style();
        }
    }
});

//Make all available 'c' seats unavailable
sc.find('c.available').status('unavailable');

/*
Get seats with ids 2_6, 1_7 (more on ids later on),
put them in a jQuery set and change some css
*/
sc.get(['2_6', '1_7']).node().css({
    color: '#ffcfcf'
});

console.log('Seat 1_2 costs ' + sc.get('1_2').data().price + ' and is currently ' + sc.status('1_2'));

});

Upvotes: 1

Views: 4475

Answers (3)

You have to initialise $$ first.

var $$ = Dom7;

Upvotes: 0

ArefinDe
ArefinDe

Reputation: 678

Add all JavaScript files in the end of body and add jquery at the end of JS Script tag.

enter image description here

Upvotes: 1

Abdul
Abdul

Reputation: 1486

download jQuery and add it your project. you need to write it before framework7.js because it uses it. so be careful you will find more here. https://stackoverflow.com/a/35590532/6594294

Upvotes: 2

Related Questions