[lightbox2] background probleem

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

  • glennvho
  • Registratie: Mei 2009
  • Laatst online: 07:28
Ik heb een probleem met mijn website die ik aan het maken ben, ik wil mijn foto's laten weergeven dmv lightbox. Alles werkt perfect tot nu toe behalve dat de achtergrond maar een stukje van mijn browserscherm inneemt. Op de lightbox support site staat er dat ik mijn body tag in css terug moet aanpassen zodat hij standaard is terug.

Dit is mijn body tag
code:
1
2
3
4
5
6
 body {
    width: 1024px;
    margin: 0px auto;
    padding: 0px;
    background-color: #c7d6ed;
}


Het probleem is dus dat ik mijn body tag gebruikt heb om mijn webpagina te centreren en er dus al mijn andere code ook al zo naar geschreven heb. Ik vraag mij dus af hoe ik bevoorbeeld de overlay een standaard breedte kan geven zodat hij altijd volledig de volledige pagina inneemt.

Dit is overigens de js code die standaard gebruikt wordt door lightbox om de breedte van een pagina te bepalen, dus zou het niet mogelijk zijn dat ik daar standaard waarden instel?

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    getPageSize: function() {
            
         var xScroll, yScroll;
        
        if (window.innerHeight && window.scrollMaxY) {  
            xScroll = window.innerWidth + window.scrollMaxX;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight;
        }
        
        var windowWidth, windowHeight;
        
        if (self.innerHeight) { // all except Explorer
            if(document.documentElement.clientWidth){
                windowWidth = document.documentElement.clientWidth; 
            } else {
                windowWidth = self.innerWidth;
            }
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }   

        // for small pages with total height less then height of the viewport
        if(yScroll < windowHeight){
            pageHeight = windowHeight;
        } else { 
            pageHeight = yScroll;
        }
    
        // for small pages with total width less then width of the viewport
        if(xScroll < windowWidth){  
            pageWidth = xScroll;        
        } else {
            pageWidth = windowWidth;
        }

        return [pageWidth,pageHeight];
    }

Acties:
  • 0 Henk 'm!

  • Bosmonster
  • Registratie: Juni 2001
  • Laatst online: 10-09 08:45

Bosmonster

*zucht*

Alle lightbox varianten hebben dit probleem. Kan ook niet anders, aangezien ze het lightbox element aan de body toevoegen en deze is in jouw geval maar 1024 pixels breed.

Het is good practice je breedte in te stellen in een wrapper div ipv je body, zodat je niet heel je viewport vernaggelt zoals je nu doet.