clankill3r
clankill3r

Reputation: 9543

changing z-index and get a scrollbar

I tried a lot of things, first in the css now with jquery but i can't get the z-index correct. The text should go over the image that is on the right side of it and not under it. If i check the z-index in the source then it's correct but still the text is on the back.

$(document).ready(function() {

    var entries = $('.entrie').length;


    $('.entrie').each(function(index){
        //console.log(index);
        var newIndex = entries-index;
        console.log(newIndex);
        $(this).css('z-index', newIndex);
    });


});

here's a jsfiddle:

http://jsfiddle.net/EJMqG/

2nd (less important), when i make the window really small then the text goes under the image, how can i prevent this? I just want scrollbars when it gets to small.

Upvotes: 0

Views: 1261

Answers (2)

Fewfre
Fewfre

Reputation: 1509

Give both elements you are applying z-index to a position:relative;. z-index doesn't work on anything that doesn't have a position.

Upvotes: 1

sushil
sushil

Reputation: 2671

Add "position:absolute;" in entrieInfo class and "position:relative;" in entrieImage class.

DEMO: http://jsfiddle.net/cX8Fy/1/

Upvotes: 1

Related Questions