Loading dynamic AJAX content into Fancybox

前端 未结 9 1417
夕颜
夕颜 2020-12-17 22:47

This scenario:

The user inserts his zip into an input-field, and when clicking the magic button, he gets to see stores closest to his location. I ca

9条回答
  •  时光取名叫无心
    2020-12-17 23:40

    I was interested in doing the same thing. I came to a similar solution, however it's different than any others recommended here. After looking at the documentation for both API's, this should work in V1 or V2.

    $('#button').on('click', function(){    
        $('#foo').load('/content.html', function(){
    
            var $source = $(this);
    
            $.fancybox({
                content: $source,
                width: 550,
                title: 'Your Title',
                etc...
            });
        });
    });
    

    Then, your container for the data.

    
    

提交回复
热议问题