문제

I want to use the google picker api . The example shows the picker being loaded when the page loads, and I want a picker to be loaded when I click on something, but it doesn't seem to work properly in that situation. So the working example is:

<script>

google.setOnLoadCallback(createImgPicker);
google.load('picker', '1');

function createImgPicker(){
  //CREATE HERE
}

</script>

but what I want is something like:

$('#button').on('click',function(){
  google.setOnLoadCallback(createImgPicker);
  google.load('picker', '1');
});

How do I accomplish this?

도움이 되었습니까?

해결책

This worked:

$('#button').on('click',function(){

  google.load('picker', '1', {"callback": function (e) {

    //do stuff

  }});
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top