调用JavaScript外部函数

时间:2017-03-18 02:42:48

标签: javascript jquery

我正在编辑现有的JavaScript jQuery库。我想知道如何将外部JavaScript函数调用到HTML中。

JavaScript函数是这样的:

AblePlayer.prototype.setDimensions = function() {

    if (this.$media.attr('width')) {
      this.playerMaxWidth = parseInt(this.$media.attr('width'), 10);
    }
    if (this.$media.attr('height')) {
      this.playerMaxHeight = parseInt(this.$media.attr('height'), 10);
    }
    // override width and height attributes with in-line CSS to make video responsive
    this.$media.css({
      'width': '100%',
      'height': 'auto'
    });
};

如何在我的HTML中调用它?

0 个答案:

没有答案