Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Js doesn't work in browser except firefox and IE

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #162961
    lisadamus
    Participant

    Hi, I used a script found in this forum of Motti here and i modified so

    $(document).ready(function() {
    
        var height = 300,
            width = 940,
    
            slides = 3,
    
            tabs = $('.tab'),
            contentNum = 1;
    
        $('.main_inner').css({
            width: slides * width
        });
    
        $('a.tab_link').click(function() {
    
            tabs.filter('.active').removeClass('active');
            $(this).parent().addClass('active');
    
            // make sure contentNum is a number and not a string
            contentNum = parseInt( $(this).attr('rel'), 10 );
    
            $('.main_inner').animate({
                marginLeft: '-' + (width * contentNum - width)
            }, 600);
    
            return false;
    
        });
    
    
    });
    

    It works fine in firefox and IE, but it doesn’t work in Opera, Chrome and Safari. Can someone help me? Thanks

    #162963
    lisadamus
    Participant

    Sorry,
    i undestood better the problem. I created 2 pages with this code. The first page is all in one and here the script doesn’t work, instead the second page is a normal html page with the script and it works.
    I don’t understand why, but i understood, the code is right.
    Can someone hel me?
    Thanks

    #162971
    lisadamus
    Participant

    Sorry again,
    I found the problem. I am using link inside for the nav menu like this
    <div class="row"><span class="anchor" id="services-home"></span><h2>Services</h2></div>
    if I remove this, the script works right.
    I don’t know how to resolve that, but I found the problem, maybe it’s already enough.
    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.