简体   繁体   中英

Multiple jquery code works in every browser apart from Firefox 3.5

I have 3 different jquery uses & put it into one code as follows:

$(function() {
    $("#ticker01").liScroll({travelocity: 0.075}); 

    $(mainContent).corner("10px");

    $(".article .thebody").hide();
    $("#mainContent .article ul")
        .prepend("<li class='readbody'><a href='' title='Read the article'>Read/Hide Story</a></li>");

    $(".actions li.readbody a").click(function(event){
        $(this).parents("ul").prev(".thebody").slideToggle("normal");

        // Stop the link click from doing its normal thing
        return false;
    }); 
});

The first one controls a scrolling news ticker, the 2nd controls rounded corners and the 3rd controls a slideToggle function. All 3 also have seperate jquery files associated to them and are linked as follows: (put BEFORE the jquery part above in the . 1st one for slidetoggle, 2nd for news ticker, 3rd for corners)

<script src="../jquery/jquery.js" type="text/javascript"></script>
<script src="../jquery/jquery.li-scroller.1.0.js" type="text/javascript"></script>
<script src="../jquery/jquery.corner.js" type="text/javascript"></script>

In Safari & IE, all 3 work fine however in FF 3.5 only the news ticker seems to work. I can't seem to get all the working at the same time in FF & i have no idea why!

Is

$(mainContent).corner("10px");

supposed to be

$('#mainContent').corner("10px");

or that selector cached in a variable mainContent ? The code you have posted looks ok in the context you have posted it, could you also provide the relevant HTML you are working with (ideally put a stripped version on JSBin for answerers to play with).

要在Firefox中调试JavaScript, Firebug是您的朋友。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM