I have few images in my database, which im displaying one below the other like a gallery but my requirement is that i want to display like a slide…one image should be displayed and after 2 seconds another image..in that way, how to get it done?
this is my view code
@{
ViewBag.Title = "Home Page";
}
<h2>@ViewBag.Message</h2>
@for(int i = 1; i <= Convert.ToInt32(ViewData["count"]); i++)
{
<img src="@Url.Action("dp", "Home",new { id = i })" />
}
You can write something yourself or you can use one of the many JavaScript/jQuery slideshow libraries available. If you write something yourself you will essentially load all of the pictures at once as you’re doing but hide them all. Then use JavaScript/jQuery to show them and hide them.
Here is one way using something called jQuery Cycle Plugin from jquery.malsup.com/cycle/.
That’s the gist anyway… You will have to modify it for your needs.