jQuery, checking to see if video has height/width

后端 未结 1 931
栀梦
栀梦 2021-01-21 04:27

I have a element that is generated by js, and I need to get the height and width of it.

var v = $(\'video\'); v.height() returns

相关标签:
1条回答
  • 2021-01-21 04:57

    Update based on new code - You can use the loadedmetadata event for this, I've updated your jsbin example here with this

    $('input').click(function () {
      $('#thumbnail video').clone().bind('loadedmetadata', function() {
        alert($('#viewing-area video').height());
      }).appendTo('#viewing-area');
    });
    
    0 讨论(0)
提交回复
热议问题