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

  • Home
  • SEARCH
  • 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 142685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:58:33+00:00 2026-05-11T07:58:33+00:00

I need to resize a div shown as a message in blockUI so that

  • 0

I need to resize a div shown as a message in blockUI so that it fills the visible screen area less some hardcoded fudge factor (so width – 100 say). The premise is that I can show a smaller image on the screen but if the user needs an enlarged image then I just show them block ui dialog sized to their screen.

The image is dynamically generated so can be sized to whatever dimensions are passed to it from the application.

I’ve looked and have only found code for centering a div. I’m working on this so if I find an answer I’ll post it here (assuming it doesn’t replicate anyone elses answers!)

Here’s a very simple html snippet for the calling markup:

<div>    <img src='someurl' class='image' height='280px' width='452px' alt='' /> </div> <div style='text-align: right;'>    <a href='#viewpopup' id='viewpopup'>View larger map</a> </div> 

And here’s the popup markup

<div id='popup'>    <div class='titlebar'>       <div class='title left'>Map details</div>       <div class='closebuttons right'><a class='close'>x</a></div>       <div class='clearer'></div>    </div>    <div class='popupcontent'>    <!-- auto append content here -->     </div>    <div class='buttonbar'>       <a class='close'>Close</a>    </div> </div> 

I’m using JQuery, here’s the current code I have:

var popup = $('#popup'); var popupcontent = popup.children('.popupcontent'); var image = $('.image'); $(document).ready(function(){     $('#viewpopup').click(function(){         // Fudged indent on the top left corner         var top = 20;         var left = 20;          // Dynamically set the contents         // popupcontent.empty();         // popupcontent.append();         $.blockUI({ message: popup, css : { border : 'none', height: 'auto', 'cursor': 'auto', 'width': 'auto', 'top': top, 'left' : left   } });      });      $('.close').live('click',function(){         $.unblockUI();     }); }); 

I’ve also got to figure out how to set the popupcontent height to auto fill the currently available space (I’m using ems in my css) but I’m unsure if that’s a separate question :).

Thanks 🙂

  • 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. 2026-05-11T07:58:34+00:00Added an answer on May 11, 2026 at 7:58 am

    I’ve got it working now. I’ve used the window width and height methods as described above. The code assumes some fudge numbers purely to make it work :).

    Note that I’m clamping the maximum width and height. Something that I’m going to move to my dynamic image generation so I don’t consume too many resources.

    Also note I’ve not included the code to pass the new dimensions to the dynamic image app, I figured that would be custom to each individual implementation.

        $('#viewmap').click(function(){         var width = $(window).width();         if(width < 200)             width = 200;         if(width > 1200)             width = 1200;          var height = $(window).height();         if(height < 200)             height = 200;         if(height > 800)             height = 800;          var popupwidth = $(window).width() - 100;         var popupheight = $(window).height() - 100;         var top = 20;         var left = (width - popupwidth) / 2 ;         popup.css('width', popupwidth);         popup.css('height', popupheight);         popupcontent.css('height', popupheight - 40) ;          popupcontent.empty();         popupcontent.append('<img src=\'someurl\' width=\''+ popupwidth + '\' height=\''+ (popupheight - 40) +'\' />');         $.blockUI({ message: popup, css : { border : 'none', height: 'auto', 'cursor': 'auto', 'width': 'auto', 'top': top, 'left' : left   } });      }); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 197k
  • Answers 197k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It sounds like the sever is expecting a cookie that… May 12, 2026 at 7:21 pm
  • Editorial Team
    Editorial Team added an answer This presentation (zip download of PPT presentation) from the java-apt… May 12, 2026 at 7:21 pm
  • Editorial Team
    Editorial Team added an answer It's because your function test() is the same as the… May 12, 2026 at 7:21 pm

Related Questions

This is the page that I'm having. But the resize part in the section
I'm having a truly... bizzare error in none other than Internet Explorer with a
I'm new to asp.net mvc, but I'm trying to do an funny app with
There is a line break between two <img> tags, and they are indented in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.