Colored
03-12-2010, 19:13
Witam.
Mam problem z umieszczeniem obrazka w tle templatki trentco (http://joomla15.cmslounge.com/?template=tem_trentco).
Chcialbym aby obraz dopasowywal sie do wielkosci przegladarki.
Znalazlem w sieci przepis css-tricks (http://css-tricks.com/perfect-full-page-background-image/) dokladnie chodzi mi o zaimplementowanie css-only technique #2.
moj zmodyfikowany index.php wyglada tak
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/common.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />
<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/overIE.js"></script>
<style type="text/css" media="all">
<?php if ($this->params->get('authorName')=='no') { ?> .author {display:none} <?php } ?>
<?php if ($this->params->get('dateCreated')=='no') { ?> .createdate {display:none} <?php } ?>
<?php if ($this->params->get('dateModified')=='no') { ?> .modifydate {display:none} <?php } ?>
<?php if ($this->params->get('Buttons')=='no') { ?> .buttons {display:none} <?php } ?>
</style>
</head>
<body id="body">
<div id="wrapper">
<div id="header">
<div id="logo">
<a href="<?php echo $this->baseurl ?>" title="Home">
<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/logo.jpg" width="200" height="90" alt="logo" />
</a>
</div>
<div id="menu"><jdoc:include type="modules" name="mainmenu" /></div>
</div><!-- end header div -->
<div id="wrapper_content">
<?php if(JRequest::getVar('view') == 'frontpage') {?>
<div id="home_img">
<jdoc:include type="modules" name="user1" style="xhtml" />
</div>
<div id="home_module">
<jdoc:include type="modules" name="center_header" style="xhtml" />
</div>
<?php } else { ?>
<div id="in_img">
<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/in_img.jpg" width="518" height="115" alt="logo" />
</div>
<div id="left">
<jdoc:include type="modules" name="left" style="xhtml" />
</div>
<div id="content">
<div id="content-padding">
<div class="module-padding">
<jdoc:include type="modules" name="abovemain" style="xhtml" />
</div>
<jdoc:include type="component" style="xhtml" />
<div class="module-padding">
<jdoc:include type="modules" name="belowmain" style="xhtml" />
</div>
</div>
</div>
<?php } ?>
<div class="clear"></div>
</div><!-- end wrapper_content div -->
<div id="right">
<jdoc:include type="modules" name="right" style="xhtml" />
</div>
<div class="clear"></div>
<div id="footer">
<div id="footermenu">
<jdoc:include type="modules" name="footer" style="xhtml" />
</div>
</div>
</div><!-- end wrapper div -->
<div class="space"></div>
</body>
</html>Prosze o podpowiedz jak lub gdzie uzyc kodu z techniki nr 2.
Probowalem juz wszystkiego i za kazdym razem porazka.
Ps. oczywiscie jestem swiadomy ze div umieszczam w index.php (tylko w ktorym miejscu?)
<div id="bg">
<img src="images/bg.jpg" alt="">
</div>reszta w pliku css
#bg {
position:fixed;
top:-50%;
left:-50%;
width:200%;
height:200%;
}
#bg img {
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
margin:auto;
min-width:50%;
min-height:50%;
}
Z gory dziekuje i pozdrawiam.
Mam problem z umieszczeniem obrazka w tle templatki trentco (http://joomla15.cmslounge.com/?template=tem_trentco).
Chcialbym aby obraz dopasowywal sie do wielkosci przegladarki.
Znalazlem w sieci przepis css-tricks (http://css-tricks.com/perfect-full-page-background-image/) dokladnie chodzi mi o zaimplementowanie css-only technique #2.
moj zmodyfikowany index.php wyglada tak
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/common.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />
<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/overIE.js"></script>
<style type="text/css" media="all">
<?php if ($this->params->get('authorName')=='no') { ?> .author {display:none} <?php } ?>
<?php if ($this->params->get('dateCreated')=='no') { ?> .createdate {display:none} <?php } ?>
<?php if ($this->params->get('dateModified')=='no') { ?> .modifydate {display:none} <?php } ?>
<?php if ($this->params->get('Buttons')=='no') { ?> .buttons {display:none} <?php } ?>
</style>
</head>
<body id="body">
<div id="wrapper">
<div id="header">
<div id="logo">
<a href="<?php echo $this->baseurl ?>" title="Home">
<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/logo.jpg" width="200" height="90" alt="logo" />
</a>
</div>
<div id="menu"><jdoc:include type="modules" name="mainmenu" /></div>
</div><!-- end header div -->
<div id="wrapper_content">
<?php if(JRequest::getVar('view') == 'frontpage') {?>
<div id="home_img">
<jdoc:include type="modules" name="user1" style="xhtml" />
</div>
<div id="home_module">
<jdoc:include type="modules" name="center_header" style="xhtml" />
</div>
<?php } else { ?>
<div id="in_img">
<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/in_img.jpg" width="518" height="115" alt="logo" />
</div>
<div id="left">
<jdoc:include type="modules" name="left" style="xhtml" />
</div>
<div id="content">
<div id="content-padding">
<div class="module-padding">
<jdoc:include type="modules" name="abovemain" style="xhtml" />
</div>
<jdoc:include type="component" style="xhtml" />
<div class="module-padding">
<jdoc:include type="modules" name="belowmain" style="xhtml" />
</div>
</div>
</div>
<?php } ?>
<div class="clear"></div>
</div><!-- end wrapper_content div -->
<div id="right">
<jdoc:include type="modules" name="right" style="xhtml" />
</div>
<div class="clear"></div>
<div id="footer">
<div id="footermenu">
<jdoc:include type="modules" name="footer" style="xhtml" />
</div>
</div>
</div><!-- end wrapper div -->
<div class="space"></div>
</body>
</html>Prosze o podpowiedz jak lub gdzie uzyc kodu z techniki nr 2.
Probowalem juz wszystkiego i za kazdym razem porazka.
Ps. oczywiscie jestem swiadomy ze div umieszczam w index.php (tylko w ktorym miejscu?)
<div id="bg">
<img src="images/bg.jpg" alt="">
</div>reszta w pliku css
#bg {
position:fixed;
top:-50%;
left:-50%;
width:200%;
height:200%;
}
#bg img {
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
margin:auto;
min-width:50%;
min-height:50%;
}
Z gory dziekuje i pozdrawiam.