jQuery fancybox - target specific div #id in iframe

后端 未结 3 1835
野性不改
野性不改 2020-12-06 13:13

Is it possible to use fancybox to load a specifc div #id from another page rather than loading the whole page via an iframe?

For example I can use

          


        
3条回答
  •  孤城傲影
    2020-12-06 13:56

    You could target the specific part of the page using beforeShow

                      function opendialog(mypage) {
                      var linktoopen=mypage ;
                        $.fancybox({                        
                        'autoScale': false,
                        'transitionIn': 'elastic',
                        'transitionOut': 'elastic',
                        'speedIn': 500,
                        'speedOut': 300,                    
                        'width'         :  800,
                        'height'        :   410,
                        'autoDimensions': false,
                        'centerOnScroll': true,
                        'scrolling'   : 'no',
                        'type' :  'iframe',
                        'href' : linktoopen,
                          beforeShow: function(){
                              $(".fancybox-iframe").css({
                              margin  : "-380px 0 0",
                             height:"790px"
                           });
                         }
                        });
                        }
    

提交回复
热议问题