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 7647555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:29:31+00:00 2026-05-31T10:29:31+00:00

I am using JQuery Cycle to produce a slideshow of images. The plugin uses

  • 0

I am using JQuery Cycle to produce a slideshow of images. The plugin uses display:none to hide the images that aren’t being shown yet, with the first image automatically having display:block on page load. I have this bit of JQuery code to vertically center my images inside the slideshow container, which works….for the very first image.

(....inside a (document.ready(function()......)

$('.variable').load(function() {
var imgHt= $('.variable').height();
var half= imgHt/2;
$('.variable').css("top", "50%");
$('.variable').css("margin-top", "-" + half + "px");

});

I tried this code without the .load(function() as well, and it’s not working correctly. The browser will display top:50% and margin-top:0px or it will display height:correct half height of image, and not display top:50%. Weird.
I’m assuming here that JQuery does not see image dimensions when its display is set to none. Is there a workaround to this?
P.S. These images are generated from a database, so no, I do not know the image’s height beforehand. Which is why I’m using JQuery in the first place.

  • 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-05-31T10:29:33+00:00Added an answer on May 31, 2026 at 10:29 am

    The browser won’t calculate the size of any element with display: none. The usual workaround is to show the element and use margins or absolute positioning to move the element (or more likely its container) somewhere thousands of pixels off the left side of the screen. Then the boxes will be calculated, you can do your manual positioning, then hide and remove the margin.

    However, since you’re using a plugin, this may not work very well. In this case, I think you’re better off modifying the plugin to display the images as you want them. It might be possible with just CSS, but that depends on the box elements used by the plugin and the styles it applies (via CSS or JS) on the boxes and the image itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the cycle jquery plugin. I have a few images that fade
I am using Jquery Cycle Plugin and it has a side panel that highlights
I am using the jQuery cycle plugin to cycle through some images. These images
I am using jQuery's cycle plugin, and found that I can call up the
I am trying to use a simple slideshow using jquery cycle plugin and It
I am using jQuery Cycle for a slideshow on this page: http://www.orientalhealthsolutions.com/ The images
I'm using the JQuery Cycle Plugin in an attempt to fade in/out images for
I'm using the jQuery Cycle plugin to cycle through some images on a webpage.
I am using the Jquery cycle plugin to create an announcements slideshow. I would
I'm using jQuery Cycle plugin to create a very simple slideshow. Below the script:

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.