Should bootstrap.js run after jquery.js or before? - jquery-ui

I want use both jquery ui and bootstrap , there is a solution
jquery-ui-bootstrap
and you must load bootstrap before jqueryui, if you won't there will apear something wrong . eg: Bialog buttons will be lose style.
but there is another error when you use radio-button if you load bootstrap before jquery.
another question about this
so? Should bootstrap.js run after jquery.js or before?

I'm pretty sure you should load jQuery first because Bootstrap uses jQuery features.

I tried to load jquery.js first, and my code is runing propertly. Try it and tell us the result, otherwise, we don't know how to help you...

Related

Rails - rack::offline not permanently caching vendor javascript

I'm building a Rails app that needs to be able to load a particular view/action while a user is offline, using the rack::offline gem... some of the functionality of the page in question is dependent on jQuery, and I added jQuery 2.2.4 to the vendor javascript folder. jQuery 2.2.4 is required in the application.js file, but the problem that I am having is that jQuery doesn't seem to be getting added to the cache, and the jQuery functionality is lost if the user refreshes the browser while offline.
I was able to temporarily resolve this issue by literally pasting the entire jQuery script into the view in question, but that is definitely not a practical solution.
How can I make sure the jQuery file in my vendor scripts is cached along with the HTML for he view in question?
The html element for the view includes the manifest attribute...
<html manifest="/application.manifest">
and from routes.rb
get '/application.manifest' => Rails::Offline
from my application.js file
//= require jquery-2.2.4.js
//= require turbolinks
//= require_tree .
And, to be comprehensive, here's the manifest...
CACHE MANIFEST
# 70f990270c71e8065f366ef4b2d73c870e89f37e4dbef32b57e0135c84b90001
404.html
422.html
500.html
NETWORK:
*
The first time I visit the page while offline (after caching), no problem, it pulls up the working cached version. However, as I mentioned, if I refresh the page, it loses the jQuery functionality ($ is undefined, etc.), although the HTML remains unchanged.
Pleased to say that I was able to figure this out...
You'll notice in my original post, there was no jQuery being included in the manifest - this is a problem! First thing, I needed to make sure that jQuery was tucked into my public folder - I added it to public/javascripts/jquery-2.2.4.js.
Now my manifest looks like this:
CACHE MANIFEST
# 70f990270c71e8065f366ef4b2d73c870e89f37e4dbef32b57e0135c84b90001
404.html
422.html
500.html
javascripts/jquery-2.2.4.js
NETWORK:
*
Lovely!
Now, despite the fact that I had put jQuery into the public folder, it wasn't automatically loading when I navigated to the view that was being cached (I'd love it if someone could help me figure out why that is happening, but it's not the end of the world). So, I added <script> src="/javascripts/jquery-2.2.4.js"></script> to the head of the layout file associated with the view, and boom, there ya go.
Now jQuery is being cached appropriately, my app runs offline.

Highcharts in the Rails Assest Pipeline not Loading

I'm working in development and am migrating from Rails 3.x to Rails 4.2.5 with Ruby 2.1. In the previous version of rails, Highcharts was working perfectly. Now I am trying to use the asset pipeline for the first time.
Within my applcation.html.erb file, I have included the line:
<%= javascript_include_tag "application" %>
Within assets/javascripts, I've verified the file "application.js" exists. Within that file I have included the lines:
//= require jquery.min
//= require rails
//= require highcharts
//= require_tree .
I have verified the files just listed above also exist in the asset/javascript. I thought that was all I needed, but I always get a blank screen when I try to display the chart. The log file says the view with the chart was rendered, but nothing is displayed. It worked perfectly in the previous version of rails, so I am ruling out the creation, handling and data values of the chart as being the source of the problem.
So what else am I missing to get Highcharts to run again? If more info is needed to help answer the question, please just let me know. Any help is greatly appreciated.
Problem solved. There was an extra comma buried within my Highcharts function call. I was able to find this by using #taglia comments about using a browser console, which in the future I will know to use as part of my debugging tool box.
Thanks to everyone for your help and insights.

Table Sorter - twitter bootstrapping

I got a rails app with twitter bootstrapping, I have a data table and I just want to know if I should integrate Table Sorter via Rails or should I use jQuery libs?
So I am trying to achieve something like this: http://tablesorter.com/docs/
What are your recommendations? I would appreciate if I could get some how-tos.
Thanks.
You can include jquery plugins in rails as you would normally include any js file.
Just copy the jquery.tablesorter.min.js from the archive into app/assets/javascripts and add this line to the application.js
//= require jquery.tablesorter.min

jquery ui css with rails 3.1

I have added jquery-ui with rails 3.1 but I am not sure where the respected css has to be added. What are necessary steps to be added for this?
We always put them in a folder underpublic/stylesheets
Edit: this is rails2-specific advice...
I am not sure if this is the best place to put it, but mine works here.
app/assets/stylesheets

JQuery + rails problem

I'm new to JQuery and so far I'm using prototype. But now I want to use JQuery and the thing is I done want to change my old code, which uses prototype
I installed jrails plugin also
my question is can i use
new Ajax.Updater etc.. kind of methods with JQuery (having the jrails plugin installed)
(it doesnt work for me)
BTW - I'm getting JQuery from here
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
thanks in advance
cheers
sameera
I'm not sure if I understand your question completely but it seems to me that you are asking if you can use both Prototype and jQuery because you don't want to have to change all your old code. The best thing to do would be to put jQuery in noConflict mode. Under your inclusion of the jquery file from google, just do this:
<script>
var $j = jQuery.noConflict();
</script>
That way jQuery won't step on Prototype's toes. instead of calling jQuery with a $ you'd use $j for example:
$j('#sidebar').hide();
I hope that helps... if indeed that's what you were asking.
I found that jrails was acting strange for me a few weeks ago. I discovered that the gem version solved my problems. Try installing it as a gem (if you're currently running it as a plugin) and see what happens.

Resources