using simplemodal, show loading spinner while content inside iframe loads

前端 未结 3 1608
误落风尘
误落风尘 2020-12-17 01:18

Good morning!

I am using the great SimpleModal plugin for jQuery from Eric Martin. Currently, I am loading a modal using an iframe to load my requested pages which

3条回答
  •  天命终不由人
    2020-12-17 01:57

    The simple answer for this is to use a load() and then place the code for the modal in load's callback. Here is an example, pseudo-code -

    $('.basic').click(function (e) {
        e.preventDefault() // use instead of return false
        var src = "http://localhost" + $(this).attr("href");
        $('iframe details').load('loading.html', function() {
            $.modal('