Adding navigation bar to external sites
For links to external content on my website I would like the user to see the external content with my navigation bar remaining at the top of the page. I want it so when the user visits the external content even开发者_高级运维 if they scroll down my navigation bar will remain fixed to the top of the page. I currently have this working for internal content but can't think of a good way of implementing this for external content such as webpages or images.
How could I go about it? Thanks
In order to have this be valid you need to use a frame.
Loading the content in an ajax request and appending it to your page will invalidate your page.
If you do go the route of making an ajax call you'll have to parse the result to get only the bits you want to show. This will be tricky, especially if the site has stylesheet,s JS files, etc.
Also, Ajax calls do not work across domains. There are things you can do and frameworks you can use to make these kinds of cross domain calls, but personally I think it's overkill given your needs.
You can use the jQuery .load()
function found here.
Simply specify a div in which to load the content and the url. Example:
$('#result').load('ajax/test.html');
精彩评论