I have an html page and i want tou include inside it another html page wich have lots of links. I was able to make it happen with an iframe, but i want the page inside the iframe to have the same color properties for the text and the links as the original page and i don't want a scrollbar, i just want to fully show the links page (around 700 lines of links), there is a limitation and i can only see 38 lines of links without scrollbar.
Is there any way to do it without iframe? or can i adjust anything else to the iframe?
Look at jQuery .load() to load a div with that requested HTML.
<style>
div.frame{
width:50%;
height:50%;
border:solid #000 1px;
}
</style>
<div class="frame"></div>
<script type="text/javascript">
$('document').ready(function(){
$('div.frame').load('/links/links1.html');
});
</script>
just link a jquery library to make it work:) hope this helps..
Related
I am working/designing the front-end (working on the layout html+css, later will use php, mvc pattern) of a website. The website has a header, body, side menu and a footer The layout is ready.
There are a few forms which are unusually long/huge since all fields are necessary and I could not make them any shorter. The form opens in a new page.
Not to scare the user away I am planning to downsize the header on the form template (the design change will only apply to the form templates) and get rid of the footer completely.
I tried looking a few places but did not find how to go it done. In short, I want the site to have all block i.e. header, body, footer but when it comes to the form I would want to downsize the header and remove the footer to make the form look sleeker.
Is there a way to do this?
Note: I post no code because I have no problem with the code but the concept.
You can use display: none for the footerelement in CSS rules that only apply to this page (for example in a style tag in the head of that page).
Concerning the header, it depends how it is built, if it has a logo, background image, text, menu, whatever. In general you could reduce the height, make the logo smaller, hide parts of the text in there etc.
You can also done this thing using angularjs
ng-include
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body >
<div ng-include="'header.html'">
</div>
<div ng-include="'footer.html'">
</div>
</body>
</html>
Make sure the body of the page has a class, for example .no-footer .small-header or .form-page. and then in your CSS stylesheet, use something like this :
body.no-footer #footer{
display:none;
}
body.small-header #header{
height:50px;
/* or whatever you want to apply to make the header smaller */
}
I am using a simple iframe code;
<iframe src="http://caesium.x10.mx/test/index.html" allowtransparency="true" style="border:none" width="852" height="500"></iframe>
And inside http://caesium.x10.mx/test/index.html there is a working button (bottom right) but if you try to click this button on the iframed page (http://caesium.x10.mx/test/index.php) the button does not work.
Can anyone help me find a solution to this?
Thanks!
The code being used for the button.
<center><button onclick="ChangeSkin()">Change Skin</button></center>
<script>
function ChangeSkin() {
location.href = 'https://www.minecraft.net/profile/skin/remote?url=https://crafatar.com/skins/' + document.getElementById('username').value + '.png';
}
</script>
Is it possible the entire iframe is behind another transparent layer?
Try setting css properties:
EDIT:
Position:static;
z-index: 1000000; (or higher than any other elements)
You can do this either in a linked .css file, or within the head tags of the page like so:
<head>
<style>
#content{
Position:static;
z-index: 1000000;
}
</style>
</head>
I often find this to be the issue when ui elements are not functioning as expected.
Your transparent footer div is overlapping the iFrame. If I give your content div a positive z-index (like #content { z-index: 1; }), then the div containing your iFrame is layered on top of the footer, and all the buttons start working again.
Iframes are great, but from what I remember the entire Iframe is one button.
Thats because of exploits that broke out a long while back. The Iframe is basically a live updated screenshot.
I have however seen many that allow links.
So, I would try the other answers first.
I have solved this problem in bootstrap 4 by adding the following to my custom stylesheet:
iframe{
z-index:9999;
}
That seemed to do the trick
I'm trying to determine the cleanest way to implement a brief loading screen that would be displayed to my site's visitors while JavaScript is loading some data behind the scenes, processing it and updating the DOM accordingly.
I like what blogger.com does with one of its themes, specifically this one. It seems to completely fill the screen with a grey background with a spinny image on top, and then it fades out once all the underlying work is completed.
Does anybody happen to know how exactly they achieve that effect? I haven't gotten too far with just poking around in Firebug. Doesn't look like it's being hidden or removed from the DOM.
Thanks!
<script type="text/javascript">
function removeOverlay(){
//code to remove the div waiting overlay
}
</script>
<body onload="removeOverlay()">
<div id='mainContainer'>
// this overlay style is in one word ugly, modify it to your style :p
<div id='waitiongOverlay' style='position:absolute;border:1px solid red; background:red; top:0; left:0; width:99%; height:99%; z-index:100;'></div>
</div>
</body>
Using a iframe where I call a site from my webspace, Using one css file with body {background-color: #222}.
The iframe src also use this CSS file. The Problem is that the body in the iframe need another background-colour.
tried
iframe>body { background-color: #other }
Any idea or suggestions?
I assume the iframe takes up a smaller portion of your site. In that case I would advice you to simply use a div with the same size of the iframe is loaded, and giving this div the proper background-color.
OR: include a style property in the source of the iframe page:
<head>
<style>body {background-color:#COLOR}</style>
</head>
This question is similar to How to apply css to iframe content?. Basically you can use jQuery to change the CSS properties in the iframe
$('#yourIframe').contents().find('body').css({
background-color: '#333333'
});
Edit:
You may need to add that when the iframe loads:
$('#yourIframe').load(function(){
$(this).contents().find('body').css({
background-color: '#333333'
});
});
Remember that a Javascript can modify only properties of iframe with the same origin of the site, otherwise you'll get a Security Error.
Protocols, domains and ports must match.
ive used this and it works for me. (and its sooooo easy!)
in your CSS file put:
iframe { background-color:orange; }
Just change the "orange" to whatever color you need.
Thats it!
Enjoy!
In the page that the iframe contains, link another stylesheet and then change all the CSS styles that you wish to.
using Javascript We can add Background Color to Iframe
var x = document.getElementById("myframe");
var y = (x.contentWindow || x.contentDocument);
if (y.document)y = y.document;
y.body.style.backgroundColor = "red";
Reference w3schools
I'd like to add a hyperlink to this background image. Should I create a new class within the stylesheet? (When I attempted to call the new class, the image disappeared).
body{
background-image:url('http://thehypebr.com/wp-content/uploads/2010/09/boundless-sem-branco-2.jpg');
background-repeat:no-repeat;
background-attachment:fixed;
line-height:20px; font-size:14px;
font-family:"Trebuchet MS";
margin:0
}
EDIT: Now there's whitespace on the top and bottom (created by the new div class?)
You're using a background-image on the body tag. Assigning a hyperlink to it is impossible.
Also, whats stopping you from using it in an img tag? This seems like a semantically valid thing to do:
<img src="http://thehypebr.com/wp-content/uploads/2010/09/boundless-sem-branco-2.jpg" alt="Image" />
But, if you must use it as a background image, than creating an additional class is the way to go.
You can place a div behind everything on the page, give it a background image, and then add an onclick handler to that div. But you can't hyperlink a background image.
You'd have to do something like:
<body>
<div id='background' onclick='window.location.href="mynewurl"'>
<!-- Rest of page goes here -->
</div>
</body>
Also, add cursor: pointer to the css for the background div so people know it's a link.
OK, I can't tell you if this would be a valid solution, because I would have to see what you actually wanted to be a link. If for example you wanted to make a link to the cream "Boundless" boxes in your background image I do have a work around. It will be a pain to get it correct cross browser, but it's doable.
Make clear gif's the same size as your cream boxes
Put those images in something like this <img src="blank.gif" alt="Link Location" />
Use CSS to make the a tag a block element and place it over the cream boxes in the background image
I would of course clean up my code, it's a mess, but I am sure you can figure that out. Just make sure to have descriptive alt tags for accessibility.
This isn't the best solution, that would be to take the "boundless" boxes out of the background image and place them instead of the blank gifs, but if you HAVE to do it for one reason or another, this option will work.
You're going to have to change your html code a bit to do that. You need to surround the image with a tag, but you can't do that to the <body> tag, obviously.
** EDIT ** Since it's been pointed out my first answer is invalid HTML (thanks, and sorry), you can use a jquery approach like this:
$(document).ready(function(){
$("body").click(function(){
window.location='http://www.yoururl.com';
});
});
The issue with setting up an onClick method, is that you remove the anchor hint at the bottom left of the browser window, as well as any SEO that might be associated with the link.
You can accomplish this with just HTML/CSS:
<style>
.background-div {
background-image:url("/path/to/image.jpg");
position:relative;
}
.href:after {
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
content:"";
}
</style>
<body>
<div class="background-div">
</div>
</body>
In this case, the relative positioning on background-div will keep the link contained to only that div, and by adding a pseudo element to the link, you have the freedom to still add text to the link (if necessary), while expanding the click radius to the entire background div.