1

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>

1 Answer 1

3

You have to include jQuery before you include your slider library because the library uses jQuery:

 @Scripts.Render("~/bundles/jquery")
 @Scripts.Render("~/bundles/slider")
Sign up to request clarification or add additional context in comments.

1 Comment

thx, I've been fighting with it for almost an hour :) It's working now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.