如何用jquery ui滑块控制css样式? [英] How to control css style with jquery ui slider?

查看:105
本文介绍了如何用jquery ui滑块控制css样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用jquery ui滑块制作控制我的php页面中表单数量的代码



这是我的php代码

I tried to make code that control the number of form in my php page wiht jquery ui slider

This is my php code

<body>
  <form id="form_number">
  <label for="minform">Choose number of form</label>
  <select name="minform" id="minform">
    <option>1</option>
    <option>2</option>
  </select>
</form>

<form action="" id="add_user" method="post">
<?php

		include "../include/form.php";

	 ?>
	</form>
	
	<form action="" name="add_user2" id="add_user2" method="post" style="visibility:hidden;">
	
	<?php

		include "../include/form.php";

	 ?>
	</form>
	
  </body>





这是js滑块代码:



this is the js slider code:

$(function() {
    var select = $( "#minform" );
    var slider = $( "<div id='slider'></div>" ).insertAfter( select ).slider({
      min: 1,
      max: 2,
      range: "min",
      value: select[ 0 ].selectedIndex + 1,
      slide: function( event, ui ) {
        select[ 0 ].selectedIndex = ui.value - 1;
      }
    });
    $( "#minform" ).change(function() {
      slider.slider( "value", this.selectedIndex + 1 );
    });
  });







id =add_user的表单显示在页面中默认情况下..

当滑块值= 2时,如何在php页面中显示id =add_user2?



我知道方法document.add_user2.visibility =visible;将改变状态并使表单出现id =add_user2,但我仍然无法正确使用..



请帮助我并告诉我方式..




The form with id="add_user" is show in page by default..
How to make the id="add_user2" visible in the php page when the slider value=2??

I know method document.add_user2.visibility = "visible"; will change the state and make the form with id="add_user2" appear,,but I still can't get it right..

Please help me and show me the way..

推荐答案

(function(){
var select =
(function() { var select =


#minform );
var slider =
( "#minform" ); var slider =


< div id ='slider'>< / div>)。insertAfter( select ).slider({
min: 1
max: 2
范围: min
value 选择 [ 0 ] .selectedIndex + 1
slide:function( event ,ui){
选择 [ 0 ] .selectedIndex = ui。 value - 1 ;
}
});
( "<div id='slider'></div>" ).insertAfter( select ).slider({ min: 1, max: 2, range: "min", value: select[ 0 ].selectedIndex + 1, slide: function( event, ui ) { select[ 0 ].selectedIndex = ui.value - 1; } });


这篇关于如何用jquery ui滑块控制css样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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