• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Container bewegen sich immer ein stück nach oben

xxbellzxx

Neues Mitglied
hallo Leute ich habe ein Problem,


ich habe eine Horizontale Internetseite erstellt mit slider und es gibt keine Verlinkungen sondern nur eine ganz große Seite quasi( doof zu erklären schauen sie sich die Dateien einfach mal an) änlcih wie diese DesignBeast


mein Problem ist das die "container" die die seiten sind sich erstmal wie geplant zur Seite bewegen aber dann ein stück hoch gehen.


und das zweite Problem ist das die buttons beim internet explorer ganz wo anders sind
also am besten erst mir firefox oder ähnliches testen ^^


ich hoffe sie können mir helfen und das ich nicht all zu sehr störe ;)


Code:
<html > <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Horizontal Layout</title> 
<style type="text/css"> #container{    width:13000px;    height:768px;}#buttons{position: fixed;}
#maincontent{border:0;margin:0;padding:0;}
#maincontent li{width:2000px;height:786px;padding:10px;float:left;}
body{background:url(bilder/mybg.jpg) no-repeat fixed; }
</style> 


</head>   <script type="text/javascript" src="js/thw.js"></script>  <body> <div id="container">
<ul id="maincontent"><li ><a name="p1" id="p1"></a><img src="layout/home.png" width="1024" height="768"></li>

<li ><a name="p3" id="p3"></a><img src="layout/skills.png" width="1024" height="768"></li>
<li ><a name="p5" id="p5"></a><img src="layout/portfolio.png" width="1024" height="768"></li>
<li ><a name="p7" id="p7"></a><img src="layout/mich.png" width="1024" height="768"></li>
<li ><a name="p9" id="p9"></a><img src="layout/kontakt.png" width="1024" height="768"></li></ul>




<div id="buttons"> <a href="#p1">Home</a> |
<a href="#p3">portfolio</a> |
<a href="#p5">skills</a> |
<a href="#p7">über_mich</a> |
<a href="#p9">Kontakt</a> |</div> 
</div></body> </html>


ps ich weis leider nicht ob es ein HTML oder CSS Fehler ist ich nehme aber CSS an bin was das angeht noch ein neuling.
 
Du nutzt keinen DOCTYPE und zwingst den Browser damit in den Quirks-Mode.

- DOCTYPE-Switch und seine Auswirkungen

Ich würde den HTML(5)-DOCTYPE empfehlen.

Ein Rahmengerüst:

HTML:
<!DOCTYPE html>

<html lang="de">

    <head>
        <meta charset="utf-8" />
        <title>Meine Seite</title>
    </head>

    <body>

    </body>

</html>

Wenn ich deinen Code 1:1 übertrage und teste, ist alles etwas ineinander verschoben, die Kästen liegen aber alle auf einer Höhe (Firefox 6).

Aber wie gesagt: Setze erst mal einen korrekten DOCTYPE, vorher rendern die Browser ohnehin, was sie wollen.
 
ja ich habe es gemacht wie du gesagt hast vielen dank hab aber nicht wirklich was gebracht :S
zu der datei fehlte noch der JS code

den js Code habe ich aus dem net, wenn du das mit einbindest dann siehst du auch was ich meine :)


Code:
/* Horizontal Tiny Scrolling - a smooth scrolling script for horizontal websites(the brother of the vertical "Tiny Scrolling")
by Marco Rosella - http://www.centralscrutinizer.it/en/design/js-php/horizontal-tiny-scrolling
                v0.2 - May 31, 2006
*/
 
window.onload = function() {
  HtinyScrolling.init(); scrollTips.init();
 }
 
var HtinyScrolling = {
 speed : 50,      //set here the scroll speed: when this value increase, the speed decrease. 
 maxStep: 150,  //set here the "uniform motion" step for long distances
 brakeK: 3,   //set here the coefficient of slowing down
 hash:null,  
 currentBlock:null,
 requestedX:0,
 init: function() {
  var lnks = document.getElementsByTagName('a');   
  var ilnks = document.getElementsByTagName('img');   
  for(var i = 0, lnk; lnk = lnks[i]; i++) {   
   if ((lnk.href && lnk.href.indexOf('#') != -1) &&  ( (lnk.pathname == location.pathname) ||
   ('/'+lnk.pathname == location.pathname) ) && (lnk.search == location.search)) {  
   lnk.onclick = this.initScroll;     
   }   
  }    
 },
 getElementXpos: function(el){
  var x = 0;
  while(el.offsetParent){  
   x += el.offsetLeft;    
   el = el.offsetParent;
  } return x;
 },  
 getScrollLeft: function(){
  if(document.all) return (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
  else return window.pageXOffset;   
 }, 
 getWindowWidth: function(){
  if (window.innerWidth) return window.innerWidth; 
  if(document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;
 },
 getDocumentWidth: function(){
  if (document.width) return document.width;
  if(document.body.offsetWidth) return document.body.offsetWidth;
 },
 initScroll: function(e){
  var targ;  
  if (!e) var e = window.event;
  if (e.target) targ = e.target;
  else if (e.srcElement) targ = e.srcElement;   
  HtinyScrolling.hash = targ.href.substr(targ.href.indexOf('#')+1,targ.href.length); 
  HtinyScrolling.currentBlock = document.getElementById(HtinyScrolling.hash);   
  if(!HtinyScrolling.currentBlock) return;
  HtinyScrolling.requestedX = HtinyScrolling.getElementXpos(HtinyScrolling.currentBlock); 
  HtinyScrolling.scroll(targ); 
  return false;
 },
 scroll: function(targ){
  var left  = HtinyScrolling.getScrollLeft();
  if(HtinyScrolling.requestedX > left) { 
   var endDistance = Math.round((HtinyScrolling.getDocumentWidth() - (left + HtinyScrolling.getWindowWidth())) / HtinyScrolling.brakeK);
   endDistance = Math.min(Math.round((HtinyScrolling.requestedX-left)/ HtinyScrolling.brakeK), endDistance);
   var offset = Math.max(2, Math.min(endDistance, HtinyScrolling.maxStep));
  } else { var offset = - Math.min(Math.abs(Math.round((HtinyScrolling.requestedX-left)/ HtinyScrolling.brakeK)), HtinyScrolling.maxStep);
  } window.scrollTo(left + offset, 0);  
  if(Math.abs(left-HtinyScrolling.requestedX) <= 1 || HtinyScrolling.getScrollLeft() == left) {
   window.scrollTo(HtinyScrolling.requestedX, 0);
   if(!document.all || window.opera) location.hash = HtinyScrolling.hash;
   //if(window.opera) {mark.change_colors(HtinyScrolling.hash, 30, 3500,'#aaaaaa','#fffbea');}
   //mark.change_opacity(HtinyScrolling.hash);
   //you can also call the function "mark.change_colors(HtinyScrolling.hash, fps, (duration in sec), #(color in hex), #(color in hex))" to change background color of selected section   
   HtinyScrolling.hash = null;
  } else  setTimeout(HtinyScrolling.scroll,HtinyScrolling.speed);   
 }
}
 
/* the mouse scrolling doesn't work with Opera, that hasn't a event associated to the mouse wheel */
 
var scrollTips = {
 dx : null,
 init : function() { 
  if (window.addEventListener) {
  window.addEventListener("DOMMouseScroll", this.mouseScroll, false);
  } else document.attachEvent("onmousewheel", this.mouseScroll); 
  var left = document.getElementById('left');
 },
 
 mouseScroll : function(e) {
  if (!e) var e = window.event;
  if (e.wheelDelta <= 0 || e.detail>=0){  
  window.scrollBy(80,0);
  } else  window.scrollBy(-80,0) ; 
 } ,
 
 arrowScroll: function(val) {
  if(val==1) {
   window.scrollBy(70,0);
  } else {
   window.scrollBy(-70,0)
  }
 }
}
 
/*var mark = {        //first four functions are based on The Fade Anything Technique by Adam Michela 
 valop : 100,
 req : 0,
 make_hex: function(r,g,b) {
  r = r.toString(16); if (r.length == 1) r = '0' + r;
  g = g.toString(16); if (g.length == 1) g = '0' + g;
  b = b.toString(16); if (b.length == 1) b = '0' + b;
  return "#" + r + g + b;
 },
 change_colors: function(id, fps, duration, from, to) {  
  var frames = Math.round(fps * (duration / 1000));
  var interval = duration / frames;
  var delay = interval;
  var frame = 0;  
  if (from.length < 7) from += from.substr(1,3);
  if (to.length < 7) to += to.substr(1,3);  
  var rf = parseInt(from.substr(1,2),16);
  var gf = parseInt(from.substr(3,2),16);
  var bf = parseInt(from.substr(5,2),16);
  var rt = parseInt(to.substr(1,2),16);
  var gt = parseInt(to.substr(3,2),16);
  var bt = parseInt(to.substr(5,2),16);  
  var r,g,b,h;
  while (frame < frames) {
   r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));
   g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
   b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
   h = this.make_hex(r,g,b);   
   setTimeout("mark.set_img_bgcolor('"+id+"','"+h+"')", delay);
   frame++;
   delay = interval * frame; 
  }
  setTimeout("mark.set_img_bgcolor('"+id+"','"+to+"')", delay);
 },  
 
 set_img_bgcolor: function(id, c) {   
     if(document.getElementById(id).getElementsByTagName('img')[0]) {
  var o = document.getElementById(id).getElementsByTagName('img')[0];
  o.style.backgroundColor = c;} else return;
 },
 get_img_bgcolor: function(id)  { 
  var o = document.getElementById(id).getElementsByTagName('img')[0];
  while(o) {
   var c;
   if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");
   if (o.currentStyle) c = o.currentStyle.backgroundColor;
   if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }
   o = o.parentNode;
  }
  if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";
  var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
  if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
  return c;
 },
 change_opacity: function(el) {
  if(!(/^menu/.test(el))) {
   var post = document.getElementById(el);
   if (mark.valop > 10 && mark.req == 0) {
    mark.valop -= 10;
    mark.set_opacity(post,mark.valop);
    if(mark.valop == 10) {mark.req = 1};
   } else 
   if (mark.valop < 100 && mark.req == 1) {
    mark.valop += 10;
    mark.set_opacity(post,mark.valop);
    if(mark.valop == 100) {mark.req = 2};
   } 
   if (mark.req != 2){
   setTimeout("mark.change_opacity('"+el+"')", 50);
   }
   else { mark.set_opacity(post,9999); mark.req = 0; return;}
  }
 },
 set_opacity: function(post,val){
  post.style.opacity='0.' + val ;
  post.style.filter="alpha(opacity=" + val + ")";
 }
 
}*/
 
Wieso eigentlich position:fixed in #button? Versuche es mal mit position:absolute und entsprechenden Werten für top und left. Außerdem würde ich die Buttons in eine Liste setzen.
 
da sich die Seite nach rechts bewegt müssen die Buttons am "Bildschirm" fixiert sein.
mit position:absolute sind sie an einer stelle wenn man durch dei seite surft bleiben die buttons an der selben stelle.
 
Ist es denn gewollt, dass die Buttons ausschließlich auf der Home-"Seite" erscheinen? Wenn ich weiter scrolle, sind sie ohnehin nicht mehr zu sehen.

Ich verstehe ohnehin nicht so ganz, warum du mehrere Seiten nebeneinander anordnest. Ein jQuery Slider auf Seitenbreite, der dynamisch Texte oder Grafiken zum jeweils gezeigten Bild einblendet, würde auf ein visuell ähnliches Ergebnis hinauslaufen, und du hättest weniger Probleme mit der Positionierung einzelner Elemente.
 
Zurück
Oben