多次点击期间的一些问题,不能重复 [英] Some problems during multiple clicks,can not be repeated

查看:57
本文介绍了多次点击期间的一些问题,不能重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在每次按下按钮时出现一个新的随机问题,但它似乎只能运行一次,加上点击后的字体样式也不起作用。你可以帮帮我吗这里? jQuery

I'm trying to make a new random question appear each time i press a button,but it seems like it works only once,plus the style of the font after clicking doesn't work as well.Can you help me out here? jQuery

    var clicked = false;
var $feild=$('#questions');
var $screen=$('.container');
$screen.hide();
 $feild.html(questions[random_number]);
 $('.button').click(function(){

if(!clicked){
 $('.button').animate({
 "top": "+=300" 
  },1000,function(){
    $screen.fadeIn(2000);
    clicked=true;
});

}else {
  $feild.replaceWith(questions[random_number]);
 }
});



HTML




HTML

<!DOCTYPE html>
<html>
<head> 
<title>English</title>

<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8">    
</head>
<body>
<div class="container clearfix">
  <ul>
<li id="questions"></li>
</ul>

</div>
<div>


 <ul>
 <li class="main-button clearfix"><a class="button clearfix" href="#">New topic</a></li>
  </ul>  
 </div>

</body>
<script type="text/javascript" src="js/app.js"></script>
<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="js/gui.js"></script>

</html>





我尝试过:


使用javascript语法
(如果没有)与boolean结合使用,但只能部分工作



What I have tried:

using javascript syntax (if else) in conjunction with boolean, but it worked only partially

推荐答案

feild =


' #questions');
var


screen =


这篇关于多次点击期间的一些问题,不能重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆