z-Index hoe werkt dat?

Gestart doorMarvinn16 reacties54 weergaven

17 berichten · pagina 1 van 2

Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi.

Ik zit al meer dan een paar dagen met het probleem dat onze popupjes (Drag volgens mij??) achter onze Headlines verdwijnen, na veel op Google te lezen blijkt het te komen door de z-Index.

Maar wat ik ook probeer, het blijft achter de headlines verdwijnen.

Heeft iemand een idee hoe ik het wel zou moeten?

Voorbeeldje:
Afbeelding

Javascript Headlines:
Spoiler tonen
<script> 
    /***********************************************
* Ultimate Fade-In Slideshow (v1.51):  Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
 var fadeimages=new Array()
 //SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["http://www.habbotjes.be/topstory/generator.php?topstory=http://www.habbotjes.be/uploads/promo_chatting.gif", "<table width=85% height=210px cellpadding=0 cellspacing=0><tr><td valign=top><div class=kop style=font-family: Verdana; color: #FFFFFF; padding-top: 8px; padding-left: 6px;    font-size: 18px; font-weight: bold;><br /><a href=?p=nieuws&nid=1753 class=wit_muisover>Versie 4 online</a></div><br /> <div class=tussentext style=font-family: Verdana;color: #FFFFFF;padding-left: 6px;font-size: 13px;>Check het bericht om te zien wat er veranderd is!</div></td></tr><tr><td valign=bottom style=padding-bottom:4px; padding-left:4px;><a href=?p=nieuws&nid=1753 class=wit_muisover>Lees meer &raquo;</a></td></tr></table>", ""] //plain image syntax
fadeimages[1]=["http://www.habbotjes.be/topstory/generator.php?topstory=http://www.habbotjes.be/uploads/promo_frontPage_steampunk3.gif", "<table width=85% height=210px cellpadding=0 cellspacing=0><tr><td valign=top><div class=kop style=font-family: Verdana; color: #FFFFFF; padding-top: 8px; padding-left: 6px;    font-size: 18px; font-weight: bold;><br /><a href=?p=nieuws&nid=1741 class=wit_muisover>Donnie Santini heeft je hulp nodig!</a></div><br /> <div class=tussentext style=font-family: Verdana;color: #FFFFFF;padding-left: 6px;font-size: 13px;>Maar waarmee? Lees snel meer!</div></td></tr><tr><td valign=bottom style=padding-bottom:4px; padding-left:4px;><a href=?p=nieuws&nid=1741 class=wit_muisover>Lees meer &raquo;</a></td></tr></table>", ""] //plain image syntax
 
 
 
 
 
/***********************************************
* Settings for Topstory
***********************************************/
var imageheight = "300"
var imagewidth =  "759"
var fadebgcolor= ""
 
/***********************************************
* End settings for Topstory
***********************************************/
 
 
 
////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write(<div id="master+this.slideshowid+" style="position:relative;width:+fadewidth+px;height:+fadeheight+px;overflow:hidden;"><div id="+this.canvasbase+_0" style="position:absolute;width:+fadewidth+px;height:+fadeheight+px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:+fadebgcolor+"></div><div id="+this.canvasbase+_1" style="position:absolute;width:+fadewidth+px;height:+fadeheight+px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:+fadebgcolor+"></div></div>)
else
document.write(<div><img name="defaultslide+this.slideshowid+" src="+this.postimages[0].src+"></div>)
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}
 
function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
 
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+=<div style="padding-left: 1px; background-image: url(+this.postimages[picindex].src+); background-position:-3px; height: +imageheight+px; width: +imagewidth+px" border="+this.imageborder+px">+this.theimages[picindex][1]+ <br />
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+=</a>
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images[defaultslide+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
} 
</script>
Javascript Drag systeem:
Spoiler tonen
function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 20

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update elements z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);

    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

function dragHidden(id, clase) {
    if(document.getElementById(id).className == "hidden"){
    document.getElementById(id).className = clase;
    document.getElementById(aktie_+id).innerHTML = "sluit";
    }else{
    document.getElementById(id).className = "hidden";
    document.getElementById(aktie_+id).innerHTML = "open";
    }
}

function openDiv(id) {
    var x = document.getElementById(id);
    if(x.style.display == "block") {
        x.style.display = "none";
    }else{
        x.style.display = "block";
    }
}
function sluitDiv(id) {
    var x = document.getElementById(id);
    x.style.display = "none";
}
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Dit heeft met je CSS te maken, Niet je javascript
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Doe bij je drag ding eens z-index: 9000;
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nielsie schreef:
Dit heeft met je CSS te maken, Niet je javascript
#vrienden_tool {
    background: url(../../images/vrienden.gif);
    background-repeat: no-repeat;
    margin:-30px 35px 0px 0px;
    float: right;
    width: 35px;
    height: 25px;
    z-index: 9000;
    }


werkt ook niet.

toevoeging op 17 maart 2013, 191709:
Jponsen schreef:
Doe bij je drag ding eens z-index: 9000;
Nop...
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Nickjexx schreef:
Eerdere citaten tonen
Nielsie schreef:
Dit heeft met je CSS te maken, Niet je javascript
#vrienden_tool {
    background: url(../../images/vrienden.gif);
    background-repeat: no-repeat;
    margin:-30px 35px 0px 0px;
    float: right;
    width: 35px;
    height: 25px;
    z-index: 9000;
    }


werkt ook niet.

toevoeging op 17 maart 2013, 191709:
Eerdere citaten tonen
Jponsen schreef:
Doe bij je drag ding eens z-index: 9000;

Nop...
Doe er nog eens wat nullen achter dan yummie
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Javascript gaat altijd boven CSS volgens mij.
Wat je dan zou kunnen doen is proberen met CSS3 je slider te maken.
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jponsen schreef:
Javascript gaat altijd boven CSS volgens mij.
Wat je dan zou kunnen doen is proberen met CSS3 je slider te maken.

Ik zou niet weten hoe, is er geen oplossing verder?
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nickjexx schreef:
Eerdere citaten tonen
Jponsen schreef:
Javascript gaat altijd boven CSS volgens mij.
Wat je dan zou kunnen doen is proberen met CSS3 je slider te maken.

Ik zou niet weten hoe, is er geen oplossing verder?
Ik weet het niet zeker, maar ik denk dat er geen andere oplossing is.

toevoeging op 17 maart 2013, 19:27:32:
Misschien moet je hier eens naar kijken?
http://iamceege.com/pure-css3-content-slider/
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
kan je de url eens geven? Dan kunnen we gewoon rustig met dev tools kijken welke elementen welke eigenschappen hebben.
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rogier schreef:
kan je de url eens geven? Dan kunnen we gewoon rustig met dev tools kijken welke elementen welke eigenschappen hebben.
www.habbotjes.be
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
demo account...?
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het werkt eenvouwdig. De z-index is een getal die aanduid hoe "hoog" het element staat. Het leuke is dat je ze zelf kan aanpassen. In dit geval staat de z-index van je headlines dus hoger als die van die popup. Als je die van je headlines lager zet is het zo opgelost. Met Firebug van FireFox zie je zo wat de headlines zon hoge z-index geeft.
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Antonn schreef:
Het werkt eenvouwdig. De z-index is een getal die aanduid hoe "hoog" het element staat. Het leuke is dat je ze zelf kan aanpassen. In dit geval staat de z-index van je headlines dus hoger als die van die popup. Als je die van je headlines lager zet is het zo opgelost. Met Firebug van FireFox zie je zo wat de headlines zon hoge z-index geeft.
Dat is het dus, als ik die van de headlines aanpas bugt het. En werkt het niet goed.
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
zet er eens position: relative; bij
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb het inmiddels gevonden, ik moest het in de DIV zetten:

<div id="vrienden" style="display:none; position:fixed; z-index:200; left:40%; top:25%;">

biggrin
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren