<script type="text/javascript"> $(document).ready(function(){ // part_one $(".pic_demo").one("mouseover", function(event){ $(".click_me").fadeIn(500); event.stopPropagation(); }); $(".pic_demo").one("mouseout" , function(event){ $(".click_me").fadeOut(250); event.stopPropagation(); }); //part_one //part_two $(".pic_demo").click(function(event){ $(this).animate({"width":"189px","height":"280px","opacity":"0.5","margin-left":"-121"} , 500) .animate({"width":"230px","height":"340px","opacity":"1","margin-left":"-121"} , 200) event.stopPropagation(); $(".pic_demo").one("mouseover", function(event){ $(".click_me_again").fadeIn(500); event.stopPropagation(); }); $(".pic_demo").one("mouseout" , function(event){ $(".click_me_again").fadeOut(250); event.stopPropagation(); }); }); //part_two //part_three $(".pic_demo").dblclick(function(event){ $(this).animate({"width":"432px","height":"640px","opacity":"1","margin-left":"-231"} , 500) .animate({"width":"230px","height":"340px","opacity":"1","margin-left":"-121"} , 200) event.stopPropagation(); }); //part_three }); </script>结果,不尽如人意啊,第一个单击的提示,确实只显示了一次,以后再不显示了。但是第二个提示,死了活了都要显示,没招,自己没经验,只能四处求助,经过别人指点,然后自己摸索,算是满足最初的设想。更新JS代码如下:
<script type="text/javascript"> var count_number = 0 ; $(document).ready(function(){ // part_one $(".pic_demo").one("mouseover", function(event){ $(".click_me").fadeIn(500); event.stopPropagation(); $(".pic_demo").one("mouseout" , function(event){ $(".click_me").fadeOut(250); event.stopPropagation(); }); }); //part_one //part_two $(".pic_demo").click(function(event){ $(this).animate({"width":"189px","height":"280px","opacity":"0.5","margin-left":"-121"} , 500) .animate({"width":"230px","height":"340px","opacity":"1","margin-left":"-121"} , 200) event.stopPropagation(); if ( count_number == 0) { $(".pic_demo").one("mouseover", function(event){ $(".click_me_again").fadeIn(500); event.stopPropagation(); $(".pic_demo").one("mouseout" , function(event){ $(".click_me_again").fadeOut(250); event.stopPropagation(); }); }); count_number = 1; } }); //part_two //part_three $(".pic_demo").dblclick(function(event){ $(this).animate({"width":"432px","height":"640px","opacity":"1","margin-left":"-231"} , 500) .animate({"width":"230px","height":"340px","opacity":"1","margin-left":"-121"} , 200) event.stopPropagation(); }); //part_three }); </script>
上一篇今儿个报到了