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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:00:39+00:00 2026-06-02T21:00:39+00:00

i’m trying to implement SpaceGallery script. WWW: http://www.eyecon.ro/spacegallery/ . It takes the images from

  • 0

i’m trying to implement SpaceGallery script. WWW: http://www.eyecon.ro/spacegallery/. It takes the images from #div and make the slide like on online demo.
Part of my HTML file:

    <div id="myGallery0" class="spacegallery">      
<img class="imaz" src="ADDITIONAL.jpg" alt="" atr1="lupa" />    
<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>

        <div id="myGallery1" class="spacegallery">      
<img class="imaz" src="ADDITIONAL.jpg" alt="" atr1="lupa" />
<img class="aaa" src=images3/bw1.jpg alt="" atr1="bw1" />
<img class="aaa" src=images3/bw2.jpg alt="" atr1="bw2" />
<img class="aaa" src=images3/lights2.jpg alt="" atr1="bw3" />
            </div>

            <script>
    var initLayout = function() {
        $('#myGallery0').spacegallery({loadingClass: 'loading'});
        $('#myGallery1').spacegallery({loadingClass: 'loading'});
                };  
        EYE.register(initLayout, 'init');
            </script>

And now, the script works good when I’m calling $(‘img.aaa’)! The script slides only images from it’s own ID (mygallery0 or mygallery1). Let’s say I have the following .onclick thing in my main .js file.

         $('img.imaz').fadeOut();

And when i’m sliding the images in one of my galleries (mygaller0 or mygallery1), the img “ADDITIONAL.jpg” (it’s class = imaz) fadeOuts in all of my galleries! Why is that? How to fix it?

Spacegallery.js

(function($){
    EYE.extend({

        spacegallery: {

            //default options (many options are controled via CSS)
            defaults: {
                border: 6, // border arround the image
                perspective: 100, // perpective height
                minScale: 0.1, // minimum scale for the image in the back
                duration: 800, // aimation duration
                loadingClass: null, // CSS class applied to the element while looading images
                before: function(){
                    $('img.imaz').fadeOut();
                    return false
                    },
                after: function(el){    
                    $('img.imaz').fadeIn();                 
                    return false
                    }
            },

            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')
                        .each(function(nr){

                            console.log('WYSOKOSC ' + $(this).attr('height'));

                            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;
                        })

            },

            //animate to nex image
            next: function(e) {
                if (EYE.spacegallery.animated === false) {
                    EYE.spacegallery.animated = true;

                    var el = this.parentNode;


                    el.spacegalleryCfg.before.apply(el);
                    $(el)
                        .css('spacegallery', 0)
                        .animate({
                            spacegallery: 100
                        },{
                            easing: 'easeOut',
                            duration: el.spacegalleryCfg.duration,
                            complete: function() {


                                $(el)
                                    .find('img.aaa:last')
                                    .prependTo(el);

                                EYE.spacegallery.positionImages(el);
                                el.spacegalleryCfg.after.apply(el);
                            }, 

                            step: function(now) {

                                $('img.aaa', this)
                                    .each(function(nr){

                                        console.log('step: ' + $(this).attr('atr1'));

                                        var newWidth, top, next;
                                        if (nr + 1 == el.spacegalleryCfg.images) {
                                            top = this.spacegallery.origTop + this.spacegallery.nextTop * 4 * now /100;
                                            newWidth = this.spacegallery.width * top / this.spacegallery.origTop;
                                            $(this)
                                                .css({
                                                    top: top + 'px',
                                                    opacity: 0.7 - now/100,
                                                    marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px'
                                                })
                                                .attr('width', newWidth);
                                        } 

                                        else {
                                            next = this.spacegallery.current - this.spacegallery.increment * now /100;
                                            newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * next;
                                            $(this).css({
                                                top: this.spacegallery.origTop + this.spacegallery.nextTop * now /100 + 'px',
                                                opacity: 1 - next,
                                                marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px'
                                            })
                                            .attr('width', newWidth);
                                        }
                                    });
                            }
                        });
                }

                this.blur();
                return false;
            },

            //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;
                        el.spacegalleryCfg.images = 3;                              
                        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) {
                            EYE.spacegallery.positionImages(el);
                        }
                    }
                });
            }
        }
    });

    $.fn.extend({

        /**
         * Create a space gallery
         * @name spacegallery
         * @description create a space gallery
         * @option  int         border          Images' border. Default: 6
         * @option  int         perspective     Perpective height. Default: 140
         * @option  float       minScale        Minimum scale for the image in the back. Default: 0.2
         * @option  int         duration        Animation duration. Default: 800
         * @option  string      loadingClass    CSS class applied to the element while looading images. Default: null
         * @option  function    before          Callback function triggered before going to the next image
         * @option  function    after           Callback function triggered after going to the next image
         */
        spacegallery: EYE.spacegallery.init
    });
    $.extend($.easing,{
        easeOut:function (x, t, b, c, d) {
            return -c *(t/=d)*(t-2) + b;
        }
    });
})(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-02T21:00:41+00:00Added an answer on June 2, 2026 at 9:00 pm

    You can try to limit the matched image to the context of the current element by passing in this as the second argument tot he selector.

    defaults: {
        /* options */
        before: function(){
            $('img.imaz', this).fadeOut();
        },
        after: function(el){    
            $('img.imaz', this).fadeIn();
        }
    }
    

    Whe we pass in this, as the second argument in the selector, we’re telling jQuery to target "img.imaz", but only when it’s found within this, meaning the current element being handled. In your project, this will be either #myGallery0, or #myGallery1.

    You can learn more about the context argument online at http://api.jquery.com/jQuery/

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words

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.