jquery function doesn't work in wordpress -
i need integrate function wordpress , need use multiple events of example , works one. advice? thanks.
<div id="example"> <p style="display: block;">3 hours</p> <p>2h , 30m</p> <p>2h</p> <p>1h , 30m</p> <p>1h</p> <p>30min</p> <p>started</p> </div> jquery $(document).ready(function(){ $("#example p:first").css("display", "block"); jquery.fn.timer = function() { if(!$(this).children("p:last-child").is(":visible")){ $(this).children("p:visible") .css("display", "none") .next("p").css("display", "block"); } else{ $(this).children("p:visible") .css("display", "none") .end().children("p:first") .css("display", "block"); } } // timer function end window.setinterval(function() { $("#example").timer(); }, 50); });
add functions.php
<?php if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); function my_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_server['server_port'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", false, null); wp_enqueue_script('jquery'); } ?>
Comments
Post a Comment