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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:21:18+00:00 2026-05-23T16:21:18+00:00

I have a basic slideshow that displays images fine when they are local/relative. If

  • 0

I have a basic slideshow that displays images fine when they are local/relative. If I try and load the image from another domain, the image loads and displays fine, but then the gallery will not advance to the next step.

Works:

<ul class="slides"> 
<li><img src="img/photos/1.jpg" width="620" height="320" alt="Turrimetta Beach - Dawn" /></li>   
<li><img src="img/photos/2.jpg" width="620" height="320" alt="Turrimetta Beach - Dawn" /></li> 
<li><img src="img/photos/3.jpg" width="620" height="320" alt="Power Station" /></li> 
<li><img src="img/photos/4.jpg" width="620" height="320" alt="Colors of Nature" /></li> 
</ul>

Loads first image and then stops:

<ul class="slides"> 
    <li><img src="http://www.alfajango.com/blog/wp-content/uploads/2010/10/rails-remote.jpg"width="620" height="320" alt="Turrimetta Beach - Dawn" /></li> 
    <li><img src="img/photos/2.jpg" width="620" height="320" alt="Turrimetta Beach - Dawn" /></li> 
    <li><img src="img/photos/3.jpg" width="620" height="320" alt="Power Station" /></li> 
    <li><img src="img/photos/4.jpg" width="620" height="320" alt="Colors of Nature" /></li> 
</ul> 

The Jquery is taken from Here

$(window).load(function(){

// We are listening to the window.load event, so we can be sure
// that the images in the slideshow are loaded properly.


// Testing wether the current browser supports the canvas element:
var supportCanvas = 'getContext' in document.createElement('canvas');

// The canvas manipulations of the images are CPU intensive,
// this is why we are using setTimeout to make them asynchronous
// and improve the responsiveness of the page.

var slides = $('#slideshow li'),
    current = 0,
    slideshow = {width:0,height:0};

setTimeout(function(){

    window.console && window.console.time && console.time('Generated In');

    if(supportCanvas){
        $('#slideshow img').each(function(){

            if(!slideshow.width){
                // Taking the dimensions of the first image:
                slideshow.width = this.width;
                slideshow.height = this.height;
            }

            // Rendering the modified versions of the images:
            createCanvasOverlay(this);
        });
    }

    window.console && window.console.timeEnd && console.timeEnd('Generated In');

    $('#slideshow .arrow').click(function(){
        var li          = slides.eq(current),
            canvas      = li.find('canvas'),
            nextIndex   = 0;

        // Depending on whether this is the next or previous
        // arrow, calculate the index of the next slide accordingly.

        if($(this).hasClass('next')){
            nextIndex = current >= slides.length-1 ? 0 : current+1;
        }
        else {
            nextIndex = current <= 0 ? slides.length-1 : current-1;
        }

        var next = slides.eq(nextIndex);

        if(supportCanvas){

            // This browser supports canvas, fade it into view:

            canvas.fadeIn(function(){

                // Show the next slide below the current one:
                next.show();
                current = nextIndex;

                // Fade the current slide out of view:
                li.fadeOut(function(){
                    li.removeClass('slideActive');
                    canvas.hide();
                    next.addClass('slideActive');
                });
            });
        }
        else {

            // This browser does not support canvas.
            // Use the plain version of the slideshow.

            current=nextIndex;
            next.addClass('slideActive').show();
            li.removeClass('slideActive').hide();
        }
    });

},100);

// This function takes an image and renders
// a version of it similar to the Overlay blending
// mode in Photoshop.

function createCanvasOverlay(image){

    var canvas          = document.createElement('canvas'),
        canvasContext   = canvas.getContext("2d");

    // Make it the same size as the image
    canvas.width = slideshow.width;
    canvas.height = slideshow.height;

    // Drawing the default version of the image on the canvas:
    canvasContext.drawImage(image,0,0);


    // Taking the image data and storing it in the imageData array:
    var imageData   = canvasContext.getImageData(0,0,canvas.width,canvas.height),
        data        = imageData.data;

    // Loop through all the pixels in the imageData array, and modify
    // the red, green, and blue color values.

    for(var i = 0,z=data.length;i<z;i++){

        // The values for red, green and blue are consecutive elements
        // in the imageData array. We modify the three of them at once:

        data[i] = ((data[i] < 128) ? (2*data[i]*data[i] / 255) : (255 - 2 * (255 - data[i]) * (255 - data[i]) / 255));
        data[++i] = ((data[i] < 128) ? (2*data[i]*data[i] / 255) : (255 - 2 * (255 - data[i]) * (255 - data[i]) / 255));
        data[++i] = ((data[i] < 128) ? (2*data[i]*data[i] / 255) : (255 - 2 * (255 - data[i]) * (255 - data[i]) / 255));

        // After the RGB elements is the alpha value, but we leave it the same.
        ++i;
    }

    // Putting the modified imageData back to the canvas.
    canvasContext.putImageData(imageData,0,0);

    // Inserting the canvas in the DOM, before the image:
    image.parentNode.insertBefore(canvas,image);
}

});

  • 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-23T16:21:19+00:00Added an answer on May 23, 2026 at 4:21 pm

    My only guess is that it has something to do with:

    $(window).load(function(){
    

    I know it’s not ideal, but try replacing the window.load with this document.ready and see what happens:

    $(document).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 pretty basic slideshow fading between images. On top of that slideshow
I have a basic form with controls that are databound to an object implementing
I have a basic CRUD form that uses PageMethods to update the user details,
I have a basic ActiveRecord model in which i have two fields that i
I have a basic C# console application that reads a text file (CSV format)
I'm looking to implement a fairly basic jQuery slideshow. One that automatically loops through
I have basic issue that i don't understand, we use HEAT to consume directory
I have basic stored procedure that performs a full text search against 3 columns
I have basic JavaScript code that needs to tell how many names out of
I have basic *.xib file, which have NSView. How can I use another nib

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.