Image in Fancybox do not adapt to the box size

Questions related to the Responsive Web Design tools of WYSIWYG Web Builder.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/respon ... esign.html
Please read this first before posting any questions! Also check out the example project to get an idea how the RWD concept works.

Responsive Web Design FAQ:
http://wysiwygwebbuilder.com/forum/view ... 10&t=63817
Post Reply
User avatar
Bluesman
 
 
Posts: 1192
Joined: Mon Feb 01, 2016 5:43 pm
Location: Sweden
Contact:

Image in Fancybox do not adapt to the box size

Post by Bluesman »

Hi wwb proos. I'm setting up a shoping page and using cards for the product presentation and Paypal order functions. The product pic is linked and opened through a Fancybox lightbox. I have modified some settings that works good but can not find out how to get the image adapt to the Fancybox size so it shrinks and enlages when the screen changes in size.
See the testpage I'm working on. It's the first product "KSCSA CAP". if you click it it opens in the Fancybox but the image does not adapt to the frame and down in sizes it get worse. Someone has a script or idea to fix this :idea:
https://www.kscsa.com.au/testsite_2024/merchandise.html
"Make My Day"

See my Website
User avatar
Pablo
 
Posts: 23223
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Pablo »

I don't think Fancybox supports this functionality.

So, it may be better to use one of the other lightboxes.
https://www.wysiwygwebbuilder.com/lightboxes.html
User avatar
BaconFries
 
 
Posts: 5867
Joined: Thu Aug 16, 2007 7:32 pm

Re: Image in Fancybox do not adapt to the box size

Post by BaconFries »

Try the following by inserting Between the <head></head> tags* in Page HTML. Note not tested!.

Code: Select all

<style>
/* Add this to your custom CSS file or modify the existing one */
.fancybox-wrap {
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
}

.fancybox-content {
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
}

.fancybox-title {
    word-wrap: break-word;
    white-space: normal;
}
</style>
User avatar
BaconFries
 
 
Posts: 5867
Joined: Thu Aug 16, 2007 7:32 pm

Re: Image in Fancybox do not adapt to the box size

Post by BaconFries »

Just another possible way. As before add to Page HTML Between <head></head> tags* Change the *Media Queries* to your own the current are set to 768px and 480px If you need more it can be added.

Code: Select all

<style>
/*  Responsive Fancybox Styles */

/* Overriding the Fancybox defaults - VERY IMPORTANT */
.fancybox-wrap {
    width: auto !important;
    height: auto !important;
}

.fancybox-inner {
    width: auto !important;
    height: auto !important;
    max-width: 90%; /* Adjust as needed */
    max-height: 90%; /* Adjust as needed */
}

.fancybox-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Media Queries */
@media (max-width: 768px) {
    .fancybox-inner {
        max-width: 95%;
        max-height: 95%;
    }
}

@media (max-width: 480px) {
    .fancybox-inner {
        max-width: 98%;
        max-height: 98%;
    }
}

/* ... more responsive styles as needed ... */
</style>
User avatar
Bluesman
 
 
Posts: 1192
Joined: Mon Feb 01, 2016 5:43 pm
Location: Sweden
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Bluesman »

Pablo wrote: Wed Feb 19, 2025 8:38 pm I don't think Fancybox supports this functionality.

So, it may be better to use one of the other lightboxes.
https://www.wysiwygwebbuilder.com/lightboxes.html
Hi Pablo tnx for rapid response. Just wonder... Are all lightboxes still working for ver 20? I had all installed since earlier versions of WWB, but now just the 4 preinstalled was there? Thought because they were deprecated they was gone?
Thanks for your "outstanding" support :D
"Make My Day"

See my Website
User avatar
Bluesman
 
 
Posts: 1192
Joined: Mon Feb 01, 2016 5:43 pm
Location: Sweden
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Bluesman »

BaconFries wrote: Thu Feb 20, 2025 2:21 am Just another possible way. As before add to Page HTML Between <head></head> tags* Change the *Media Queries* to your own the current are set to 768px and 480px If you need more it can be added.

Code: Select all

<style>
/*  Responsive Fancybox Styles */

/* Overriding the Fancybox defaults - VERY IMPORTANT */
.fancybox-wrap {
    width: auto !important;
    height: auto !important;
}

.fancybox-inner {
    width: auto !important;
    height: auto !important;
    max-width: 90%; /* Adjust as needed */
    max-height: 90%; /* Adjust as needed */
}

.fancybox-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Media Queries */
@media (max-width: 768px) {
    .fancybox-inner {
        max-width: 95%;
        max-height: 95%;
    }
}

@media (max-width: 480px) {
    .fancybox-inner {
        max-width: 98%;
        max-height: 98%;
    }
}

/* ... more responsive styles as needed ... */
</style>
Hi Bacon :D , tnx for your suggestions. I will try them, because I like the "Fancybox" lightbox. I will report the outcome...
"Make My Day"

See my Website
User avatar
Bluesman
 
 
Posts: 1192
Joined: Mon Feb 01, 2016 5:43 pm
Location: Sweden
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Bluesman »

Bluesman wrote: Thu Feb 20, 2025 9:29 am
BaconFries wrote: Thu Feb 20, 2025 2:21 am Just another possible way. As before add to Page HTML Between <head></head> tags* Change the *Media Queries* to your own the current are set to 768px and 480px If you need more it can be added.

Code: Select all

<style>
/*  Responsive Fancybox Styles */

/* Overriding the Fancybox defaults - VERY IMPORTANT */
.fancybox-wrap {
    width: auto !important;
    height: auto !important;
}

.fancybox-inner {
    width: auto !important;
    height: auto !important;
    max-width: 90%; /* Adjust as needed */
    max-height: 90%; /* Adjust as needed */
}

.fancybox-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Media Queries */
@media (max-width: 768px) {
    .fancybox-inner {
        max-width: 95%;
        max-height: 95%;
    }
}

@media (max-width: 480px) {
    .fancybox-inner {
        max-width: 98%;
        max-height: 98%;
    }
}

/* ... more responsive styles as needed ... */
</style>
Hi Bacon :D , tnx for your suggestions. I will try them, because I like the "Fancybox" lightbox. I will report the outcome...
Tested both examples... without any luck :( but I'm not so good in coding, but saw one error... The second querie was also max-width, should be max-hight I guess so I changed...
"Make My Day"

See my Website
User avatar
Pablo
 
Posts: 23223
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Pablo »

Are all lightboxes still working for ver 20?
Yes, all lightboxes also work with ver 20

https://www.wysiwygwebbuilder.com/lightboxes.html
User avatar
Bluesman
 
 
Posts: 1192
Joined: Mon Feb 01, 2016 5:43 pm
Location: Sweden
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Bluesman »

Pablo wrote: Thu Feb 20, 2025 10:02 am
Are all lightboxes still working for ver 20?
Yes, all lightboxes also work with ver 20

https://www.wysiwygwebbuilder.com/lightboxes.html
Got it Pablo... I installed all lightboxes, but not all appears when setting the lightbox in Page properties, but when adding a Photo Gallery they all appear, so I can see just a few work for my specific usage.
"Make My Day"

See my Website
User avatar
Pablo
 
Posts: 23223
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Pablo »

but not all appears when setting the lightbox in Page properties
Yes, this is expected behavior. See the note in the tutorial about this.
User avatar
Bluesman
 
 
Posts: 1192
Joined: Mon Feb 01, 2016 5:43 pm
Location: Sweden
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Bluesman »

Pablo wrote: Thu Feb 20, 2025 11:11 am
but not all appears when setting the lightbox in Page properties
Yes, this is expected behavior. See the note in the tutorial about this.
Thanks Pablo... I shall try to remember :?
"Make My Day"

See my Website
User avatar
Bluesman
 
 
Posts: 1192
Joined: Mon Feb 01, 2016 5:43 pm
Location: Sweden
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Bluesman »

So... now I chosen the lightbox that I think works best for my purpose "GLightbox" https://github.com/biati-digital/glight ... md?plain=1
Trying to modify so the lightbox opens in 640 pxl width and auto hight. I use the model that I used for "Fancybox" for the extra settings:

Code: Select all

'data-width':'640px',
'data-height':'auto',
'data-zoomable':'true'
Nothing happens. Shall I use another method for this lightbox? Anyone have an idea :idea:
"Make My Day"

See my Website
User avatar
crispy68
 
 
Posts: 2995
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by crispy68 »

where is data-width, data-height coming from? shouldnt it just be:

Code: Select all

'width':'640px',
'height':'auto'
https://github.com/biati-digital/glightbox
User avatar
Bluesman
 
 
Posts: 1192
Joined: Mon Feb 01, 2016 5:43 pm
Location: Sweden
Contact:

Re: Image in Fancybox do not adapt to the box size

Post by Bluesman »

crispy68 wrote: Thu Feb 20, 2025 1:21 pm where is data-width, data-height coming from? shouldnt it just be:

Code: Select all

'width':'640px',
'height':'auto'
https://github.com/biati-digital/glightbox
Hi crispy, tnx for dropping in. Yes tried that first but not working, so I checked in the codes on the link I had in my post.
"Make My Day"

See my Website
Post Reply