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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:46:43+00:00 2026-06-03T06:46:43+00:00

I have a small problem with loading and position one of my images. The

  • 0

I have a small problem with loading and position one of my images. The smallest one. I’m using spacegallery script (http://www.eyecon.ro/spacegallery/).

It’s loading good, but i want it to position it in the corner of bigger image, and when i load my page for the first time, it’s not positioned, when i reload it – it’s all fine, but the first loading is wrong.

Here are the screens:
It’s the first load without refreshing the site:

first load http://derivativeofln.com/withoutload.png

Second and next loads:

second load http://derivativeofln.com/withload.png

My HTML:

    <div id="myGallery" class="spacegallery">   

    <img class="imaz" src=http://derivativeofln.com/magnifier.jpg />
    <img class="aaa" src=images/bw1.jpg alt="" atr1="bw1" />
    <img class="aaa" src=images/bw2.jpg alt="" atr1="bw2" />
    <img class="aaa" src=images/bw3.jpg alt="" atr1="bw3" />

            </div>      

MY CSS:

#myGallery0 {
width: 100%;
height: 300px;
 }

#myGallery0 img {
border: 2px solid #52697E;
 }

a.loading {
background: #fff url(../images/ajax_small.gif) no-repeat center;
}

.imaz {
 z-index: 10000; 
}


.imaz img{
position: absolute;
left:10px;
top:10px;
z-index: 10000;
width: 35px;
height: 35px;   
}

My Jquery main script file: (the first positioning instructions are on the bottom, so feel free to scroll down : ))

(function($){
   EYE.extend({

    spacegallery: {



        animated: false,

        //position images 
        positionImages: function(el) {

            var top = 0;

            EYE.spacegallery.animated = false;
            $(el)
                .find('a')
                    .removeClass(el.spacegalleryCfg.loadingClass)
                    .end()
                    .find('img.aaa')
                    .removeAttr('height')
                    .each(function(nr){
                        var newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * el.spacegalleryCfg.asins[nr];

                        $(this)
                            .css({
                                top: el.spacegalleryCfg.tops[nr] + 'px',
                                marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px',
                                opacity: 1 - el.spacegalleryCfg.asins[nr]
                            }) 
                            .attr('width', parseInt(newWidth));
                        this.spacegallery.next = el.spacegalleryCfg.asins[nr+1];
                        this.spacegallery.nextTop = el.spacegalleryCfg.tops[nr+1] - el.spacegalleryCfg.tops[nr];
                        this.spacegallery.origTop = el.spacegalleryCfg.tops[nr];
                        this.spacegallery.opacity = 1 - el.spacegalleryCfg.asins[nr];
                        this.spacegallery.increment = el.spacegalleryCfg.asins[nr] - this.spacegallery.next;
                        this.spacegallery.current = el.spacegalleryCfg.asins[nr];
                        this.spacegallery.width = newWidth;
                    })

        },


        //constructor
        init: function(opt) {
            opt = $.extend({}, EYE.spacegallery.defaults, opt||{});
            return this.each(function(){
                var el = this;
                if ($(el).is('.spacegallery')) {
                    $('<a href="#"></a>')
                        .appendTo(this)
                        .addClass(opt.loadingClass)
                        .bind('click', EYE.spacegallery.next);

                    el.spacegalleryCfg = opt;
                    var listunia, images2 = [], index;
                    listunia = el.getElementsByTagName("img");

                    for (index = 1; index < listunia.length; ++index) {
                        images2.push(listunia[index]);
                    } 


                    el.spacegalleryCfg.images = images2.length;             
                    el.spacegalleryCfg.loaded = 0;
                    el.spacegalleryCfg.asin = Math.asin(1);
                    el.spacegalleryCfg.asins = {};
                    el.spacegalleryCfg.tops = {};
                    el.spacegalleryCfg.increment = parseInt(el.spacegalleryCfg.perspective/el.spacegalleryCfg.images, 10);
                    var top = 0;

                    $('img.aaa', el)
                        .each(function(nr){
                            var imgEl = new Image();
                            var elImg = this;

                            el.spacegalleryCfg.asins[nr] = 1 - Math.asin((nr+1)/el.spacegalleryCfg.images)/el.spacegalleryCfg.asin;
                            top += el.spacegalleryCfg.increment - el.spacegalleryCfg.increment * el.spacegalleryCfg.asins[nr];
                            el.spacegalleryCfg.tops[nr] = top;
                            elImg.spacegallery = {};
                            imgEl.src = this.src;
                            if (imgEl.complete) {

                                el.spacegalleryCfg.loaded ++;
                                elImg.spacegallery.origWidth = imgEl.width;
                                elImg.spacegallery.origHeight = imgEl.height
                            } else {
                                imgEl.onload = function() {
                                    el.spacegalleryCfg.loaded ++;
                                    elImg.spacegallery.origWidth = imgEl.width;
                                    elImg.spacegallery.origHeight = imgEl.height
                                    if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) {

                                        EYE.spacegallery.positionImages(el);

                                    }
                                };
                            }
                        });




                    el.spacegalleryCfg.asins[el.spacegalleryCfg.images] = el.spacegalleryCfg.asins[el.spacegalleryCfg.images - 1] * 1.3;
                    el.spacegalleryCfg.tops[el.spacegalleryCfg.images] = el.spacegalleryCfg.tops[el.spacegalleryCfg.images - 1] * 1.3;
                    if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) {


                            if(el.spacegalleryCfg.images == 3){
                            $('img.imaz', this).css('top', '27px'); // HERE IS POSITIONING OF MY IMAGES, WHEN SCRIPT LOADS FOR THE FIRST TIME!
                            $('img.imaz', this).css('left', (($(el).find('img.aaa:last').width())/2 + 77) + 'px' );
                            }
                            else if(el.spacegalleryCfg.images==2){
                                $('img.imaz', this).css('top', '33px');     
                                $('img.imaz', this).css('left', (($(el).find('img.aaa:last').width())/2 + 77) + 'px' ); // HERE IT ENDS:)
                            }

                        EYE.spacegallery.positionImages(el);
                    }
                }
            });
        }
    }
});
})(jQuery);
  • 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-03T06:46:44+00:00Added an answer on June 3, 2026 at 6:46 am

    this seems to be a cache thing
    try to specify image dimensions (width and height) on your html, because on first load (images not in cache) the browser only knows dimensions after the load and the positioning might not be correct.

    in alternative you can run your positioning code when the document is loaded

    $(document).ready(«your poisitioning function here»)
    

    see http://api.jquery.com/ready/ for that jquery ready function

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

Sidebar

Related Questions

I have a small issue on a search form. PLease check this: http://www.fortisfitness.ca/test/script.php What's
I currently have a small Python script that I'm using to spawn multiple executables,
I have a small problem with rollover effects. First time after loading everything's fine.
I have a small problem using the video creation capability of OpenCV. For the
I wrote a small HTTP server in Java and I have a problem passing
have small problem, and would very much appreciate help :) I should convert byte
I have small problem with Spring MVC. Basically what I'm trying to do is
I have a small problem and I've figured out where when and why it
I have a small problem which i can't seem to figure out. I tried
I have a small problem which i can't seem to solve myself. Look at

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.