Murray Brown
asked on
ASP.net page jumps when rotating images but second time smooth
Hi
I just put up the following ASP.net site: www.leadershipsurvey.co.za
I am using the VB.net code below to load 10 images one by one every three seconds
The problem is that on the first rotation the screen jumps.
It doesn't jump on the second rotation.
How do I fix this? Do I perhaps load them all very quickly on the page load?
Please go to the site to see what I mean
Thanks
Protected Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Call Display_Next_Image()
End Sub
Sub Display_Next_Image()
Try
Dim intLast As Integer = CInt(Me.lblImageNumber.Tex t)
Dim oNextNumber As String
If intLast = 10 Then
Me.Image1.ImageUrl = "~/Images_Slide2/1.jpg"
Me.lblImageNumber.Text = "1"
Else
oNextNumber = intLast + 1
Me.Image1.ImageUrl = "~/Images_Slide2/" & oNextNumber.ToString & ".jpg"
Me.lblImageNumber.Text = oNextNumber.ToString
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
I just put up the following ASP.net site: www.leadershipsurvey.co.za
I am using the VB.net code below to load 10 images one by one every three seconds
The problem is that on the first rotation the screen jumps.
It doesn't jump on the second rotation.
How do I fix this? Do I perhaps load them all very quickly on the page load?
Please go to the site to see what I mean
Thanks
Protected Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Call Display_Next_Image()
End Sub
Sub Display_Next_Image()
Try
Dim intLast As Integer = CInt(Me.lblImageNumber.Tex
Dim oNextNumber As String
If intLast = 10 Then
Me.Image1.ImageUrl = "~/Images_Slide2/1.jpg"
Me.lblImageNumber.Text = "1"
Else
oNextNumber = intLast + 1
Me.Image1.ImageUrl = "~/Images_Slide2/" & oNextNumber.ToString & ".jpg"
Me.lblImageNumber.Text = oNextNumber.ToString
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A normal javascript slide show will 'preload' the images so they appear 'instantly' instead of being loaded from the server each time in the first round. This slideshow demo on one of my pages shows that. http://www.dibsplace.com/webdev/SlideShow.html I could shorten the transition time so they fade in and out very quickly. It's the "Ultimate Fade In Slideshow v2.0" http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm There are quite a few like that but I've seen many others using it.
Here's a version using the first 6 of your images: http://www.dibsplace.com/webdev/SlideShow-demo2.html You can look at the view source and copy the code if you want.
ASKER
Simple and effective. Great stuff! Thanks