Can an iframe only show a certain part of the page?

An <iframe> gives you a complete window to work with. The most direct way to do what you want is to have your server give you a complete page that only contains the fragment you want to show.

As an alternative, you could just use a simple <div> and use the jQuery “load” function to load the whole page and pluck out just the section you want:

$('#target-div').load(' #portfolio-sports');

There may be other things you need to do, and a significant difference is that the content will become part of the main page instead of being segregated into a separate window.

Leave a Comment