is there a way hide elements in IFRAME src page?

前端 未结 4 978
一向
一向 2020-12-06 14:04

I have a very simple code. I like to hide some DIV\'s in my IFRAMe. So my index.html page looks like this, so the whole idea is hide the top and the leftpanel of from the Ca

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 14:28

    You can try this:

    $('#iframeID').load(function(){
        $('#iframeID').contents().find('#leftpanel').hide();
        $('#iframeID').contents().find('#toppanel').hide();
    });
    

    Or:

    $(document).ready(function(){
        $('#iframeID').contents().find('#leftpanel').hide();
        $('#iframeID').contents().find('#toppanel').hide();
    });
    

    This method is not possible if you want to work with different domains.

提交回复
热议问题