Hi I'm using jQuery in my ASP.NET website. I try to make slider using scripts
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/css-default")
@Styles.Render("~/Content/css-menu")
@Styles.Render("~/Content/css-style")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/slider")
@Scripts.Render("~/bundles/jquery")
<script type="text/javascript">
$(function() {
$('.banner').unslider({
speed: 500,
delay: 3000,
complete: function() {},
keys: false,
dots: true,
fluid: false
});});
</script>
</head>
in version where i don't use ASP.NET script is working, but when I copied it to Layout.cshtml it doeas not...
<div id="slider">
<div class="banner">
<ul>
<li><img src="~/Images/1.jpg"></li>
<li><img src="~/Images/2.jpg"></li>
<li><img src="~/Images/3.jpg"></li>
</ul>
</div>
</div>
You have to include jQuery before you include your slider library because the library uses jQuery:
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/slider")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.