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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:19:15+00:00 2026-06-13T13:19:15+00:00

I have a ruby on rails web app, and in some views i have

  • 0

I have a ruby on rails web app, and in some views i have many heavy images( <img> ) to render .The <img> are generated in a Helper.

The problem is that the css is loaded first, then the js, then the heavy images , and then finally the css refereneced background images.

It takes quite a while for all of the heavy images to load, which therefore holds the whole site up.

I want to load first the css background images then load the other images, as they obviously hold visual structure of the page.

rails version: 2.3.8

EDIT:
Thank you guys, I apologize for not having shared the code earlier.

I have two models : Categories and Images, each Category has many images.
In the view i have a list of categories, which is generated by a helper :

 
categories.each do |cat|
    html << "<a href='##{cat.id}' class='mapcat' >#{cat.libelle}</a>"
end

and when I click on the category the images are displayed

 categories_images.each do |i|
    html << "<div id='#{i.id}' class='#{css}'><img src='/images_moi/categories/#{cat.libelle}/#{i.path_file_name}' />"
  end

I have css background image associated to the list of category
The problem is that the images (<img>) is displayed before the css background images of the list of categories.

  • 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-13T13:19:17+00:00Added an answer on June 13, 2026 at 1:19 pm

    We need to assume things because you haven’t shared your code.

    Coming to your query, for now you can preload images using jQuery:

    function preload(arrayOfImages) {
        $(arrayOfImages).each(function(){
            $('<img/>')[0].src = this;
            // Alternatively you could use:
            // (new Image()).src = this;
        });
    }
    
    // Usage:
    
    preload([
        'img/imageName.jpg',
        'img/anotherOne.jpg',
        'img/blahblahblah.jpg'
    ]);
    

    This saves the loading time of loading images.

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

Sidebar

Related Questions

Some of the users of our Ruby on Rails app have complained that page
I have a Ruby/Rails app, which is standard Rails CRUD, with some jQuery and
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I have a ruby on rails app running a server and sometimes it needs
I have a Ruby on Rails app running on my server, and I can't
I have a Ruby on Rails app that I've recently deployed to a remote
i've developed small web app for personal use with Ruby on Rails. Now when
I have a Ruby on Rails 3.2 app using bundler and capistrano for deployment.
I have a twitter like web application written in Ruby on Rails that allows
I have a plain ruby application (it's not a Web app, so not using

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.