Is the link's href set to another page? If so, I'm surprised it works in any browser. You would need to return false after your animate methods:

        $(document).ready(function(){
           $(".action").click(function(){
               $("#panel")
               .animate({top:"0px"}, 500)
                .animate({top:"0"}, 4000)
                .animate({top:"-75px"}, 500);
                return false; // <-- prevent the link from being followed.
           });
             $("#panel").click(function(){
               $("#panel").hide();
           });
       });


--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Oct 19, 2009, at 8:55 AM, Vali wrote:


Hello,

Recently I encountered a problem in Opera: The browser does not run
any javascript after a page is submitted.
For example if you use animate on an anchor when you click on that
anchor the animate is never run unless the href is set to "#".

This is the code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript">

        $(document).ready(function(){
           $(".action").click(function(){
               $("#panel")
               .animate({top:"0px"}, 500)
                .animate({top:"0"}, 4000)
                .animate({top:"-75px"}, 500);
           });
             $("#panel").click(function(){
               $("#panel").hide();
           });
       });

</script>


<style type="text/css">
body {
        margin: 0;
        padding: 0;
        font: 75%/120% Arial, Helvetica, sans-serif;
        background: #323232;
}
#panel {
        background: #eaeaea;
        height: 75px;
        width: 100%;
        position: absolute;
        top:-75px;
}
.action
{
        padding: 2px;
        color: white;
        margin: 0 auto ;
        background: #777777;
        padding:  5px;
        border:2px solid #323232;
}

</style>
</head>

<body>

<div id="panel">
        Your profile customization has been saved.
</div>

<div style="margin-top: 500px;text-align:center;">

<a href="some link other than #. With # it works" class="action">Save
bla bla</a>

</div>
</body>
</html>

Reply via email to