Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to jquery and can't find seem to figure why it works in everything but IE

XML
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js""></script>
</head>
    <body>
<ul class="slides">
  <li class="screenshot"><p>Text 1</p><img class="phone" src="one.png"></li>
  <li class="screenshot"><p>Text 2</p><img class="phone" src="two.png"></li>
  <li class="screenshot"><p>Text 3</p><img class="phone" src="three.png"></li>
  <li class="screenshot"><p>Text 4</p><img class="phone" src="two.png"></li>
  <li class="screenshot"><p>Text 5</p><img class="phone" src="three.png"></li>
</ul>


 <script>
 $(function () {
        $('#right-arrow').click(function (ev) {
            ev.preventDefault();
            var $visibleImage, total, stack;
            $visibleImage = $('.screenshot:visible');
            total =  $('.screenshot').length;
            stack = $visibleImage.prevAll().length;
            $(this).attr('href') === stack++;

            if (stack === total) {
                stack = 0;
            }
            $visibleImage.fadeOut('slow');

                $('.screenshot:eq(' + stack + ')').fadeIn('slow');

        });
 });

 </script>
Posted
Comments
markovl 1-Mar-13 1:53am    
What do you mean by not working? Is there an error? Or the script doesn't get called? Or jQuery is not loaded?
There is not enough information in this question as is.

1 solution

You're not giving us enough information to go on, but this code seems to run fine in both IE7 and IE8 on my machine (using JQuery version 1.8.2). It does exactly what you're telling it to in the code - when a button's clicked it fades out all images on the page and then fades in the one the 'stack' counter is currently pointing to.
 
Share this answer
 
v2

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