0

I donwloaded and used a jQuery image slider template in my code. I use WebMatrix to design my website. But sometimes I migrate to VS2008 to create the ContactUs form etc., which I feel is easier to work with VS2008.

The slider worked perfect when running from WebMatrix but when from VS2008, I just get the images one below the other. I don't get it, its the same code running, same library, everything is the same but then, why this problem?

Below is the js source path. Please tell me if you need anything else. Thank you!

    <script type="text/javascript" src="demo/scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../jquery.nivo.slider.js"></script>
<script type="text/javascript">
$(window).load(function() {
    $('#slider').nivoSlider();
});
</script>
A_AR
  • 508
  • 2
  • 6
  • 20
  • is your nivo slider js on root or in scripts under demo? – Jai Dec 16 '12 at 06:43
  • @Jai It is in the root. I tried to point the jQuery library to google API but still that didn't work either. – A_AR Dec 16 '12 at 06:45
  • is your jquery 1.7.1 getting loaded? – Jai Dec 16 '12 at 06:46
  • @Jai What do you mean? How do I find that out? – A_AR Dec 16 '12 at 06:54
  • try get an alert('loaded'); or console.log('loaded'); in the window.load handler – Jai Dec 16 '12 at 07:03
  • @Jai This is my first website. Pardon my poor knowledge. I debugged it with Firebug. Got 404 network errors saying file not found for my java scipt file and some of the style sheets as well. Worked fine with WebMatrix!! – A_AR Dec 16 '12 at 07:35

2 Answers2

1

Have had similar issues with script file references. Found this to correct the problem:

<script type="text/javascript" src="@Href("~/demo/scripts/jquery-1.7.1.min.js")"></script>
<script type="text/javascript" src="@Href("~/jquery.nivo.slider.js")"></script>

See: Working with File and Folder Paths in Code at: http://www.asp.net/web-pages/tutorials/basics/2-introduction-to-asp-net-web-programming-using-the-razor-syntax

Skillet
  • 21
  • 3
0

Try using this way:

<script type="text/javascript" src="demo/scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery.nivo.slider.js"></script>
 //                             ---^-------------------just removed the ../
<script type="text/javascript">
  $(window).load(function() {
    $('#slider').nivoSlider();
  });
</script>

try once if this helps.

Jai
  • 74,255
  • 12
  • 74
  • 103
  • Nope that didn't help. The images are all over my web page, moving around! – A_AR Dec 16 '12 at 06:56
  • Alright. This is weird. I had to remove the "../" in all the style sheet links, not just the js file. Somehow it worked. I would love to know what just happened. How was webmatrix able to run it? – A_AR Dec 16 '12 at 07:45
  • i don't use webmatrix so i don't have enough knoledge about it, i prefer to use wamp or xampp for my web development. May be webmatrix manages internally these errors. – Jai Dec 16 '12 at 07:48