At the end of the starter page is this:
<script src="../assets/js/bootstrap-scrollspy.js"></script>
<script src="../assets/js/bootstrap-tab.js"></script>
<script src="../assets/js/bootstrap-tooltip.js"></script>
<script src="../assets/js/bootstrap-popover.js"></script>
<script src="../assets/js/bootstrap-button.js"></script>
<script src="../assets/js/bootstrap-collapse.js"></script>
<script src="../assets/js/bootstrap-carousel.js"></script>
<script src="../assets/js/bootstrap-typeahead.js"></script>
But I think with version 2, you just include 1 JavaScript file, don't you?
Yes. This actually threw me for a loop the other day.
The bootstrap.js file in the current .zip downloadable from the Bootstrap page has all of the plugins included. You don't need to (and shouldn't) include them separately if you're using the default .js file.
cf_PhillipSenn. The link provided by cetver in the comments is what you are looking for where you can customize what features you will be using, and then download it into a compiled file. If you know plugins you will be using from the beginning, might be the way to go.
The chunk you see on the bottom of the bootstrap page makes it easy to add / remove plugins as you need them.
Related
So I had some external scripts being called on one of my views. I searched the URL, copied and pasted each function into a new js script locally. Then I bundled my script files in bundle config. The functions were rendering find and displaying correctly.But now after bundling and then trying to use #Script.Render. The display is slightly messed up.
Before
After
I've checked spelling and the paths were correct, so why is #Script.render not working, when essentially the same scripts worked before. Does jQuery have a tendency to not work when bundled or something?
Let me know if you have additional questions or need to see code..
Scripts:
<script src="~/Scripts/tools/jquerydatatables.js"> </script>
<script src="~/Scripts/tools/responsivebootstrap.js"></script>
<script src="~/Scripts/tools/bootstrapdatatable.js"></script>
<script src="~/Scripts/tools/responsivedatatable.js"></script>
<script src="~/Scripts/tools/cloudpopper.js"></script>
<script src="~/Scripts/tools/twitter.js"></script>
Bundle:
bundles.Add(new ScriptBundle("~/bundles/scripts/desktop")
.Include(
"~/Scripts/tools/bootstrapdatatable.js",
"~/Scripts/tools/cloudpopper.js",
"~/Scripts/tools/jquerydatatables.js",
"~/Scripts/tools/responsivebootstrap.js",
"~/Scripts/tools/responsivedatatable.js",
"~/Scripts/tools/twitter.js"
));
css sheet is linked with:<link href="//cdn.datatables.net/1.10.18/css/dataTables.bootstrap4.min.css" rel="stylesheet" />
but my css sheet is not bundled with the java script, but that shouldn't be a problem right?
This is the code that messes up the display when I use it:#section Scripts{
#Scripts.Render("~/bundles/scripts/desktop")
As far as I can see you have a css issue:
If you want to bundle css you need to use Styles.Render("~/css/myVirtualPath").
In bundle config class then you put something like this:
bundles.Add(new StyleBundle("~/css/myVirtualPath").Include("~/Styles/myStyle.css"))
New to bootstrap and javascript and was trying to build a fairly minimal example of a dropdown menu. I am using bootstrap 2.3.2 which is the current version. My css and js are visible in my IDE. From the bootstrap docs it seems that a standard install of bootstrap.js contains bootstrap-dropdown.js and I can see it in the file. Yet, I need to have the following for the drop down menu to work:
<script src="http://code.jquery.com/jquery.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script>
Why do I have to load bootstrap-dropdown.js separately if it is included in bootstrap.js? Obviously there is something fundamental here that I don't understand. Thanks.
From Bootstrap website :
Plugins can be included individually (though some have required
dependencies), or all at once. Both bootstrap.js and bootstrap.min.js
contain all plugins in a single file.
Both bootstrap.js and bootstrap.min.js contain all plugins in a single file. you do not need the bootstrap-dropdown.js if you include bootstrap.min.js or bootstrap.js from the bootstrap page, check this overview on Bootstrap site. i can see that you are including both bootstrap.min.js and bootstrap.js but only one is enough.
Check the demo here, only using bootstrap.js.
Also, you can download a customized version from here, just according to your need you can add components/plugins and then download the custom build.
I'm using modal and dropbox js of twitter bootstrap in my project and having problem using the two.
I have added the following script tags in my html -
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-dropdown.js"></script>
Now, if I keep both tags, dropdown js does not work but if I remove the first one, dropdown works but I cannot use modal. Is adding a separate js for modal dialog i.e bootstrap-modal.js is the only solution or am I missing something here?
Both bootstrap.js and bootstrap.min.js contain all plugins in a single file. you do not need the bootstrap-dropdown.js if you include bootstrap.min.js
From the bootstrap page
http://twitter.github.io/bootstrap/javascript.html
Both bootstrap.js and bootstrap.min.js contain all plugins in a single file. you do not need the bootstrap-dropdown.js if you include bootstrap.min.js.
I also face the same problem sometimes. Sometime its difficult to predict the behavior of scripts with twitter bootstrap. Like there is plugin for dropdown in bootstrap.js but still not working. if you include separate dropdown.js then there is no issue
I have just started learning jQuery today, i have written up a code in a javascript file. This code is designed to make a button fade when hovered over it, and then return to normal after moving the mouse away. Now as i have just said, i am very new to jQuery, and that means i am thinking this is down to setting it up wrong. Here is my javascript contents :
$(document).ready(function(){
$(".buttons").mouseenter(function(){
$(".buttons").fadeTo("fast",0.25);
});
$(".buttons").mouseleave(function(){
$(".buttons").fadeTo("slow",1);
});
});
This javascript file is saying to fade my class "buttons" when i hover over them.. I have linked my HTML file to this js file with:
<script type="text/javascript" src="script.js">
I know that links up to the javascript file correctly, as i open my html and the console says "$ is not defined" on line 1. Now that is the very first line of my javascript. So clearly my html is opening my JS file, but isnt liking the $ on the very first line.
Again, ill repeat, i am very new to this and anything that should be obvious, will not be obvious to me. Thanks for any help i get.
The dollar sign belongs to jQuery libraries namespace so you need to include jQuery before using it. After including the library you can use these functions, e.g. for selection via $('.classname').
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
This includes the latest jQuery release in the minified version. You can load and host this file local as well.
Did you include jQuery in your html file? Something like
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
This must be included before the first use of $, thus before including your script.js
so i have a little problem
my webadress looks a little like this:
http://localhost:23425/dynamicName/Home.aspx
the dynamicName part well....will be dynamically named. So because of that it breaks my
<script type="text/javascript" src="Scripts/jquery.js"> </script>
scripts since it can't find it. however if its
http://localhost:23425/Home.aspx
then the javascript works.
So my question is how can i get the javascript to work on the dynamic virtual directory and not have my links be broken?
i've tried this :
<script type="text/javascript" src="<%=ResolveClientUrl("~/Scripts/Menu.js")%>"> </script>
with the script links and the css links but it doesn't seem to do it. just a grey box drops down with no content.
Any help will be extremely apprectiated
Try:
<%=ResolveUrl("~/Scripts/Menu.js") %>
ResolveClientUrl creates a path which includes ../. That may be your problem.