Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: IE7 jQuery
I am new to jquery and can't find seem to figure why it works in everything but IE
 
<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 28-Feb-13 20:47pm
Comments
markovl at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v2

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

  Print Answers RSS
0 Kornfeld Eliyahu Peter 169
1 George Jonsson 145
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 1 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100