Sitede Tıklandığında başka bir site açmak |
5 Mesajlar | 2.548 Okunma |
html, body {
width: 100%;
height: 100%;
min-height: 500px;
min-width: 500px;
}
#background {
width: 100%;
height: 100%;
z-index: 99999;
}
#background a img {
width: 100%;
height: 100%;
z-index: 99999;
<script></script>
<script>
function setBackgroundSize(e) {
//min height and width
var minWidth = 500;
var minHeight = 500;
var background = YAHOO.util.Selector.query('div#background a img')[0];
var viewportWidth = YAHOO.util.Dom.getViewportWidth();
var viewportHeight = YAHOO.util.Dom.getViewportHeight();
if(viewportWidth > minWidth) {
document.body.style.width = viewportWidth + 'px';
} else {
document.body.style.width = minWidth + 'px';
}
if(viewportHeight > minHeight) {
document.body.style.height = viewportHeight + 'px';
} else {
document.body.style.height = minHeight + 'px';
}
}
//subscribe to the events
YAHOO.util.Event.onDOMReady(setBackgroundSize);
YAHOO.util.Event.addListener(window, 'resize', setBackgroundSize);
</script>
style.css kodu:html, body {
width: 100%;
height: 100%;
min-height: 500px;
min-width: 500px;
}
#background {
width: 100%;
height: 100%;
z-index: 99999;
}
#background a img {
width: 100%;
height: 100%;
z-index: 99999;
kodundan sonra aşağıdakileri ekleyin:
<script></script>
<script>
function setBackgroundSize(e) {
//min height and width
var minWidth = 500;
var minHeight = 500;
var background = YAHOO.util.Selector.query('div#background a img')[0];
var viewportWidth = YAHOO.util.Dom.getViewportWidth();
var viewportHeight = YAHOO.util.Dom.getViewportHeight();
if(viewportWidth > minWidth) {
document.body.style.width = viewportWidth + 'px';
} else {
document.body.style.width = minWidth + 'px';
}
if(viewportHeight > minHeight) {
document.body.style.height = viewportHeight + 'px';
} else {
document.body.style.height = minHeight + 'px';
}
}
//subscribe to the events
YAHOO.util.Event.onDOMReady(setBackgroundSize);
YAHOO.util.Event.addListener(window, 'resize', setBackgroundSize);
</script>