Javascript not loading in IE7

I am having problems loading jQuery in IE7, it works fine in all other browsers, firefox, safari, opera, ie8 just not in IE7.

If anyone has any idea, please let me know.

Many thanks,

Q

It's up

<script  src="js/jquery.js" type="text/javascript"></script>
<script  src="js/plugins.js" type="text/javascript"></script>

<script type="text/javascript">
$(function(){
$('#coda-slider-1').codaSlider();
    $('#coda-services-1').codaSlider();
        $('#coda-work-1').codaSlider();

$("a[rel=rab]").fancybox({
                'transitionIn'  : 'fade',
                'transitionOut' : 'fade',
                        'titlePosition'     : 'over',
            });
$("a[rel=annsummers]").fancybox({
                'transitionIn'  : 'fade',
                'transitionOut' : 'fade',
                        'titlePosition'     : 'over',
            });
$("a[rel=sportingbet]").fancybox({
        'transitionIn'      : 'fade',
        'transitionOut'     : 'fade',
                'titlePosition'     : 'over',
    });
$("a[rel=ryman]").fancybox({
        'transitionIn'      : 'fade',
        'transitionOut'     : 'fade',
        'titlePosition'     : 'over',
    });
$('a').click(function() {
   var elementClicked = $(this).attr("href");
   var destination = $(elementClicked).offset().top;
   $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 1000 );
   return false;
    });
});

 function formatText(index, panel) {
          return index + "";
        }    
        $(function () {
            $('.slider').slider({
                easing: "easeInOutQuart", 
                autoPlay: true, 
                delay: 3300,   
                startStopped: false, 
                animationTime: 900, 
                hashTags: false, 
                buildNavigation: true,
                pauseOnHover: true,  
                navigationFormatter: formatText   
            });
        $("#slide-jump").click(function(){
                $('.slider').slider(6);
            });    
        });
 function formatText(index, panel) {
          return index + "";
        }    
        $(function () {
            $('.history-slider').slider({
                easing: "easeInOutQuart", 
                autoPlay: false,    
                delay: 3000,    
                startStopped: false,        
                animationTime: 900,         
                hashTags: false,       
                buildNavigation: false,   
                pauseOnHover: true,      
                navigationFormatter: formatText       
            });
        $("#slide-jump").click(function(){
                $('.history-slider').slider(6);
            });    
        });

</script>
+3
source share
3 answers

The problem is trailing commas; IE do not like it. Here is one, for example:

$("a[rel=rab]").fancybox({
    'transitionIn'  : 'fade',
    'transitionOut' : 'fade',
    'titlePosition' : 'over',  // <= the trailing comma
});

He also does not like it in array initializers.

+13
source

You can save a ton of input by simply declaring this parameter block once:

var fancyboxSetup = {
  'transitionIn'  : 'fade',
  'transitionOut' : 'fade',
  'titlePosition'     : 'over'
};

then just use it by name:

$("a[rel=rab]").fancybox(fancyboxSetup);

You may also find that you can configure all your anchors in one call:

$('a[rel]').fancybox(fancyboxSetup);
0

, - .

$("a[rel=sportingbet]").fancybox({
        'transitionIn'      : 'fade',
        'transitionOut'     : 'fade',
                'titlePosition'     : 'over', <---------
    });

In addition, you can combine all the elements into one selector to save the file size. I do not know if you need flexibility for transistors.

$("a[rel=annsummers], a[rel=sportingbet], a[rel=sportingbet], a[rel=ryman]").fancybox({
        'transitionIn'      : 'fade',
        'transitionOut'     : 'fade',
                'titlePosition'     : 'over'
    });
0
source

Source: https://habr.com/ru/post/1736335/


All Articles