javascript - jquery add class on click event not working -
in project have menu , give them ids sub menu , it's in header.php
<div class="top-menu"> <ul> <nav class="cl-effect-13"> <li><a href="about.php" id="about">about</a></li> <li><a href="product.php" id="product">products</a></li> <li><a class="scroll" href="#news" id="news">news</a></li> <li><a href="typography.php" id="typo">typo</a></li> <li><a href="contact.php" id="contact">contact</a></li> </nav> </ul> </div>
now when click goes about.php or if click contact goes contact.php. in about.php insert jquery this.
<script type="text/javascript"> $(document).ready(function() { /* var defaults = { containerid: 'totop', // fading element id containerhoverid: 'totophover', // fading element hover id scrollspeed: 1200, easingtype: 'linear' }; */ $().uitotop({ easingtype: 'easeoutquart' }); $('#about').addclass('active'); }); </script>
and different php file give diff. id. it's working fine till insert following code in footer.php
<script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script> <script> function sendcontactus() { var valid; valid = validatecontactto(); if(valid) { jquery.ajax({ url: "dropusline.php", data:'fname='+$("#fname").val()+'&lname='+$("#lname").val()+'&email='+$("#email").val()+'&phone='+$("#phone").val()+'&message='+$("#message").val(), type: "post", success:function(data){ $("#mail-statusto").html(data); }, error:function (){} }); } } function validatecontactto() { var valid = true; $(".text").css('background-color',''); $(".error").html(''); if(!$("#email").val()) { $("#email-info").html("(required)"); $("#email").css('background-color','#ffffdf'); valid = false; } if(!$("#message").val()) { $("#message-info").html("(required)"); $("#message").css('background-color','#ffffdf'); valid = false; } return valid; } </script>
it's ajax code inquiry in footer part , include footer.php files mention in header.php. want javascript code in footer.php jquery code perform. jquery code not performing.
it doesn't have easing , ui totop scripts. include them before invoking plugin.
in order:
<script src="http://lab.mattvarone.com/projects/jquery/totop/js/jquery-1.7.2.min.js"></script> <script src="http://lab.mattvarone.com/projects/jquery/totop/js/easing.js"></script> <script src="http://lab.mattvarone.com/projects/jquery/totop/js/jquery.ui.totop.js"></script> <script> $().uitotop({easingtype: 'easeoutquart'}); </script>
Comments
Post a Comment