Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9213277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:42:32+00:00 2026-06-18T01:42:32+00:00

How do I fully stretch an image to a window via Fancybox? (Fancybox 2)

  • 0

How do I fully stretch an image to a window via Fancybox? (Fancybox 2)
The fancybox stretches as big as the image size, but no further.

I noticed a number of CSS limits stuck in the fancybox css, like:

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

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

Taking the max-width/height out and setting let’s say width/height to 200% does stretch the image, but the containing rectangle itself (ie: the fancybox) is the same size, and it is no longer centered.

I am using the inline method with eg: jQuery(".fancybox").fancybox()

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:42:34+00:00Added an answer on June 18, 2026 at 1:42 am

    The i-pretty-much-gives-up-except-for-some-cool-but-useless-stuff approach:

    .fancybox({
     afterLoad  : function () {
      function gcd (x, y) {while (y != 0) {var z = x % y; x = y; y = z;} return x}
      var body = $(document.body)
      if (this.width/this.height > 1) {
       // Max size is document body width.
       var body_width = body.width()
       var current_multiplier = gcd (this.width, body_width)
       if (current_multiplier == 1) current_multiplier = body_width
      } else {
       // Max size is document body height.
       var body_height = body.height()
       var current_multiplier = gcd (this.height, body_height)
       if (current_multiplier == 1) current_multiplier = body_height
      }
      this.width  = this.width  * current_multiplier
      this.height = this.height * current_multiplier
     }
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsfiddle.net/TurtleWolf/P7xKm/ All I'm trying to do is center/stretch an image regardless of monitor size
Duplicate of: Stretch and Scale CSS Background How do I stretch a background image
I need to be able to stretch a image background to fit the window
How do stretch my gridview item to fit in full size, I've drawn a
I have a window where I add a new UserControl to (with an image),
I would like to stretch and crop an image so that it shows full
I'm trying to stretch an image vertically in a parent container of my site
I am using a Silverlight 3.0 Image control, setting it's Stretch property=Uniform. Unless I
How do I make a Canvas stretch fully horizontally with variable width? This is
I have a banner that uses an image as the background. The image's size

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.