Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
dears,
i am trying to add image auto slider to a user control that is used in many pages
useing the code below, and every thing is ok and the image slider works normally but after a few second or minutes the slider will stop, i tried to debug i notice that the opacity is equal to zero and when i change it in it while debugging it will continue for other second and reset to zero. i tried to set it explicitly to 100 as shown in the code below but also it back to zero after few seconds

what is the problem and why the opacity is reset to zero

PHP
var imgs = '';
       $(function () {
           var cnt = imgs.length;
           var $imageSlide = $('img[id$=imageSlide]');
           $imageSlide.attr('src', imgs[cnt - 1]);
           $imageSlide[0].style.opacity = 100;
           setInterval(Slider, 5000);
           function Slider() {
               $imageSlide.fadeOut("slow", function () {
                   $(this).attr('src', imgs[(imgs.length++) % cnt]).fadeIn("slow");
               });
           }
       });



ASP.NET
<img id="imageSlide"  runat="server" style="opacity: 100" height="200" width="750" />
Posted
Updated 6-Aug-14 0:19am
v3

create class in your css file ad opacity in that and apply that class to your image control.
 
Share this answer
 
Maybe this happens, because the only valid value for the opacity attribute is from 0-1. So 100 isnot valid attribute.

ASP.NET
<img id="imageSlide" runat="server" style="opacity: 1" height="200" width="750" />


Try this code instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900