Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fancybox: 100% width -100px

I'm currently trying to find a way to display FancyBox over the whole width of my screen with a 100px margin on the left. I tried this

jQuery

$(document).ready(function() {
    $(".fancybox").fancybox({
     'width': '100%'         
 });
});

and CSS

.fancybox-wrap {
position: absolute;
left: 100px;
}

Ok, this works fine, but now i have a horizontal scrollbar in my browser that is caused by the 100 percent + 100px width.

What I'm wondering now, is there a way to get the 100 percent browser width minus 100px? I tried this, but it didn't work:

jQuery

$(document).ready(function() {
   $(".fancybox").fancybox({
   'width': (100% - 100) + "px"      
   });
});

Would be great if anyone could provide some working lines of code, I totally suck at coding. TY.

like image 366
Tbys Avatar asked Sep 09 '26 15:09

Tbys


1 Answers

Without editing any css, fancybox provides you the options

$(".fancybox").fancybox({
    width: "100%",
    margin: [0, 0, 0, 100] // top, right, bottom, left
});
like image 81
JFK Avatar answered Sep 12 '26 04:09

JFK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!