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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:23:52+00:00 2026-06-02T10:23:52+00:00

I have the below function in a javascript file in the asset pipeline folder,

  • 0

I have the below function in a javascript file in the asset pipeline folder, I have set this file in the requirements on the application.js file below all the other libraries in loading order. The file loads in the browser correctly.

For some reason it is not working, so currently i’m adding it to the erb file and it works correctly, but i would like to know how to use it in the asset pipeline.

Am i declaring it incorrectly or something?

 $(function(){

      var $container = $('#container');

      $container.isotope({
        itemSelector: '.element'
      });

    });

this is the view:

<div id="container" class="super-list width2 height2  clearfix">

    <% @feature.issues.each do |issue| %>
    <div class="element metalloid isotope-item   " data-symbol="Mg" data-category="alkaline-earth">
    <p class="number">  <%= issue.id %> </p>
  <h2 class="symbol"> <%= link_to issue.title, [@feature, issue] %> </h2>

  </div>
  <% end %>

</div>
  • 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-02T10:23:54+00:00Added an answer on June 2, 2026 at 10:23 am

    Based on the comments then, what you need to do is instead of putting this code just inside a $(function() {}) block, you need to put it inside an event block for whatever is triggering the load. Looking at the pjax documentation, I think there’s a pretty clear cut answer.

    https://github.com/defunkt/jquery-pjax

    It states: “pjax will fire two events on the container you’ve asked it to load your reponse body into. pjax:start and pjax:end“.

    So i think if you bind the div with the end event, and pass your function in, it should work. If not, you might want to post your view code.

    Edit

    I think you’re close. Based on the code you added, the on flag should be attached to where you have your pjax bound to an element. Given that the first line you posted was:

    $('a.pjax').pjax() 
    

    I’m thinking you can try the following:

    $('a.pjax').pjax().on('pjax:end', function(){ 
      var $container = $('#container'); 
      $container.isotope({ itemSelector: '.element' }); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a javascript function below where it removes an appended file name from
I have a javascript function below where it removes an appended file name from
I have a javascript function below where when a file has finished uploading, it
I have a JavaScript function below where it displays a message after file uploading
I have Javascript as below: <script type="text/javascript" language="javascript"> function redirectToPrevious(abcURL) { window.location.replace(abcURL); } function
I have JavaScript of ajax uploader as below; $(document).ready(function(){ var qwerty = $('#qwerty').val(); $('#demo1').ajaxupload({
I have the below prog Object.prototype.inherit = function(baseConstructor) { this.prototype = (baseConstructor.prototype); this.prototype.constructor =
I have below a javascript function which gets called on click of two separate
I'm wondering the best way to approach this. I have a JavaScript file in
Suppose I have 1) a HTML document. 2) This HTML document loads Javascript file

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.