Can I call a function when pop-up modal is opened?

5 댓글

  • Ahmed Zaid
    User Group Leader Community Moderator
    Zendesk Luminary

    Hi Benessa Mae Dumol,

    Are you creating a new modal instance with each click of these buttons? 

    0
  • Benessa Mae Dumol

    Hi Ahmed Zaid,

    Thank you for responding to my query.

    Yes, I am creating a new instance using this script

    client.invoke('instances.create', {
      location: 'modal',
      url: 'assets/modal.html',
      size: { // optional
        width: '80vw',
        height: '70vh'
      }
    }).then(function(modalContext) {
      // The modal is on the screen now!
      var modalClient = client.instance(modalContext['instances.create'][0].instanceGuid);
      client.on('modalReady', function setHtml(){
        modalClient.trigger('drawData', html);
        client.off("modalReady", setHtml);
      });
      modalClient.on('modal.close', function() {
      // The modal has been closed.
        console.log('The modal has been closed');
      });
      });

    Let me know if you want to see my whole code.

    Thank you,
    Benessa

    0
  • Benessa Mae Dumol

    Hello Ahmed Zaid, do you have other input to my question above?

    I've looked for ways to fix this issue but was not successful.

    Looking forward to any response.

    Thank you,
    Benessa

    0
  • Ahmed Zaid
    User Group Leader Community Moderator
    Zendesk Luminary

    Hi Benessa Mae Dumol,

    I am really sorry for overlooking this. I found the email notification under a huge pile of overdue responses. Did you manage to solve this?

    0
  • Benessa Mae Dumol

    Hi Ahmed Zaid,

    No worries. I was able to solve it using CSS instead.

    Thank you for your help.

    Benessa

    0

댓글을 남기려면 로그인하세요.

Zendesk 제공