My Bootstrap Navbar toogler button is just showing not working - javascript

Here is my project structure and my navbar toogler button is appearing but not working while i'm clicking the toggler button.

The order of the scripts is wrong, first you must go jquery, popper and finally bootstrap, since bootstrap requires them, put them like this
<script src="js/jquery.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>

The order of scripts tag must be:
<script src="js/jquery.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
bootstrap requieres jquery for some functions

Related

i want to use modal but i just keep on getting $(...).modal is not a function. I have used jquery and bootstrap js in proper order

my imports for modal are
<script type="text/javascript" src="../../resources/js/checkbox_hide.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="application/javascript" src="../../resources/js/bootstrap.min.js"></script>
and i am calling it as..
function showPandLModal(){
$('#vehiclePandLModal').modal('toggle');
};
i am making some small error but unable to find it.
Change
<script type="text/javascript" src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
to
<script type="text/javascript" src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
Add this too:
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
i used "js" imports from other page where modal was working. It worked but i am still not sure about what imports are needed for modal. Any Explanation is welcomed.

What is the correct sequence of including jquery files?

Today i wanted to add datepicker() to my page.So I downloaded jqueryui and added then in the sequence below.
<script type="text/javascript" src="js/jquery.js"></script>
<script src="js/superfish.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/retina.min.js"></script>
<script src="assets/validate.js"></script>
<script src="js/jquery.placeholder.js"></script>
<script src="js/functions.js"></script>
<script src="js/wizard_func.js"></script>
<script src="check_radio/jquery.icheck.js"></script>
<script type="text/javascript" src="js/navi_artstyle.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="js/mapmarker.jquery.js"></script>
<script type="text/javascript" src="js/mapmarker_func.jquery.js"></script>
It didn't work. It took me whole day to figure out what is wrong. it was the SEQUENCE of js files included!!! To work my code i had to include them like bellow.("jquery.js" position had to change)
<script src="js/superfish.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/retina.min.js"></script>
<script src="assets/validate.js"></script>
<script src="js/jquery.placeholder.js"></script>
<script src="js/functions.js"></script>
<script src="js/wizard_func.js"></script>
<script src="check_radio/jquery.icheck.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/navi_artstyle.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="js/mapmarker.jquery.js"></script>
<script type="text/javascript" src="js/mapmarker_func.jquery.js"></script>
Can some one explain this please. Please give me a Source so I wont make this mistake again.
Normal jQuery (core)
jQuery migrate if you have
jQuery UI
jQuery mobile
Scripts that need jQuery / scripts that are jQuery plugins
Other scripts like bootstrap
You own scripts depending which is needed first
First you have to include normal jQuery library.After that You have to include other jquery library like jquery ui and jquery mobile and all finally you have to include your own javascript files.
As mentioned in comments you have to mention the scripts in the order you use that.
Simply anything used Jquery will goes after jQuery, anything that depends on jQuery UI goes after jQuery UI etc.

Javascript / jquery files conflicting with each other

I am using a theme which references 4 javascript/jquery files and I am using a slider image which is referencing 3 javascript/jquery files. However, they are conflicting with each other.
What files are conflicting with each other and how can I fix this issue?
Thanks
<!-- Code for theme -->
<script src="js/libs/modernizr-2.6.2.min.js"></script>
<!-- Code for sliding banner -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.js"></script>
<script type="text/javascript" src="rs-plugin/js/jquery.themepunch.plugins.min.js"></script>
<script type="text/javascript" src="rs-plugin/js/jquery.themepunch.revolution.min.js"></script>
<!-- Code for theme -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.9.0.min.js">\x3C/script>')</script>
<script src="js/main.js"></script>
1) .min is just minified version of file.
2) don't use both.
3) either use .min or normal jquery library.
<!-- Code for sliding banner -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.js"></script>
<script type="text/javascript" src="rs-plugin/js/jquery.themepunch.plugins.min.js"></script>
<script type="text/javascript" src="rs-plugin/js/jquery.themepunch.revolution.min.js"></script>
<!-- Code for theme -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.js"></script>
<script src="js/main.js"></script>
<script src="js/libs/modernizr-2.6.2.min.js"></script>
You don't need to add these:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.9.0.min.js">\x3C/script>')</script>
Because you are loading jQuery1.10+ above all other scripts, so why do you need to add jQuery.min.js and jQuery.1.9.0.
As this code comment says:
<!-- Code for theme -->
For a theme you don't need multiple jQuery libs to be loaded in a single page.
I'm not sure but have you tried $.noConflict() ?

Script conflicts with JQuery

I am looking to add charts to sortable portlets in JQuery. I just ran into an issue and was wondering what causes it and how I can fix it or get around it. My original sources were:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
Then I added:
<script src="http://static.pureexample.com/js/flot/excanvas.min.js"></script>
<script src="http://static.pureexample.com/js/flot/jquery.flot.min.js"></script>
<script src="http://static.pureexample.com/js/flot/jquery.flot.pie.min.js"></script>
When I added these, the frames and ui functions of each portlet no longer work or are visible, but the text still is. What conflicts are causing this and what is the proper way to add something like a chart to an individual portlet?
You're including jQuery twice:
<!-- here --><script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<!-- and here --><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
Remove the second line (earlier version) and you should be in business.

JavaScript jQuery fancybox

I have a problem with fancybox. I read a few answers here, but had't found a solution for my problem. I have these scripts loaded in my webpage:
Sripts for fancybox:
<script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
Other scripts that my page includes:
<script src="assets/js/jquery-1.8.3.min.js"></script>
<script src="assets/js/jquery.plugins.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/plugins/selectnav/selectnav.min.js"></script>
<script src="assets/plugins/tweet/jquery.tweet.js"></script>
<script src="assets/plugins/fitvids/jquery.fitvids.js"></script>
<script src="assets/plugins/isotope/jquery.isotope.min.js"></script>
<script src="assets/plugins/sharrre/jquery.sharrre-1.3.4.min.js"></script>
<script src="assets/plugins/revolutionslider/js/jquery.themepunch.revolution.min.js"></script>
<script src="assets/js/template.js"></script>
<script src="assets/js/customizer.js"></script>
Problem is that when I have all of these fancy box won't work. I tryed many combinations and found that the only possible for a fancbox to work is to remove script 'jquery-1.8.3.min.js' from page. If I remove it dropdown menu is not working, and the fancybox does.
Where is the problem? I just copied scripts, not a body code, because I toought it's not nessesary.

Categories