在rails中创建隐藏和显示效果的最佳方法是什么?是使用JQuery类型的解决方案还是内置的内容更好,更好或更容易?
我有2个HTML TR,我让他们runat="server"&visible="false"我也叫下拉列表citiesDropDownList
$(document).ready(function() {
$('#<%=citiesDropDownList.ClientID %>').change(function() { ValidateCity(); });
});
Run Code Online (Sandbox Code Playgroud)
并且在更改此下拉列表时,我检查其文本是否等于字符串我显示2 tr如下所示
function ValidateCity() {
if ($('#<%= citiesDropDownList.ClientID %> :selected').text() == identity_CityOther) {
$('#<%= otherCityTR.ClientID %>').show();
$('#<%= areasTR.ClientID %>').show();
}
var city = $('#<%= citiesDropDownList.ClientID %>').val();
return IsValid((city.length != 0), '#<%= cityDiv.ClientID %>', identity_CityRequired);
}
Run Code Online (Sandbox Code Playgroud)
.show()根本不起作用,我不是理由..能不能引导我解决问题?
FYI:我想 $('#<%= otherCityTR.ClientID %>').show('slow');还$('#<%= otherCityTR.ClientID %>').css('visibility', 'visible'); ,但它不也行...
好吧,这是一个令人尴尬的简单问题,但我无法让这个工作正常!我有两张uiscrollviews,我已经在IB的各个地方联系过了.在viewDidLoad上,我只希望第一个可见.所以我mkae两个scrollViews:
[scrollView1 setBackgroundColor:[UIColor blackColor]];
[scrollView1 setCanCancelContentTouches:NO];
scrollView1.clipsToBounds = NO; // default is NO, we want to restrict drawing within our scrollview
scrollView1.indicatorStyle = UIScrollViewIndicatorStyleWhite;
scrollView1.minimumZoomScale = 1;
scrollView1.maximumZoomScale = 5;
scrollView1.delegate = self;
[scrollView1 setScrollEnabled:YES];
imageView31 = [[UIImageView alloc] initWithImage:firstImage];
[scrollView1 addSubview:imageView31];
//[scrollView1 setFrame:CGRectMake(0, 0, 1024, 660)];
[scrollView2 setBackgroundColor:[UIColor blackColor]];
[scrollView2 setCanCancelContentTouches:NO];
scrollView2.clipsToBounds = NO; // default is NO, we want to restrict drawing within our scrollview
scrollView2.indicatorStyle = UIScrollViewIndicatorStyleWhite;
scrollView2.minimumZoomScale = 1;
scrollView2.maximumZoomScale = 5;
scrollView2.delegate = self;
[scrollView2 …Run Code Online (Sandbox Code Playgroud) 我正在尝试将动画添加到我的应用程序中,该动画将隐藏或在单击时显示菜单.基本上类似于Pulse新闻阅读器的文章观点.我能够为菜单容器设置动画.但是,菜单不会在主容器为菜单持有者创建空间的同时向下滑动.我想知道如何解决这个问题.
这是我的动画代码:
if(homeTabBar.getVisibility() == View.GONE){
homeTabBar.setVisibility(View.VISIBLE);
final Animation tabBlockHolderAnimation = AnimationUtils.loadAnimation(ArticleActivity.this, R.anim.tab_down);
tabBlockHolderAnimation.setFillAfter(true);
homeTabBar.startAnimation(tabBlockHolderAnimation);
}else{
final Animation tabBlockHolderAnimation = AnimationUtils.loadAnimation(ArticleActivity.this, R.anim.tab_up);
tabBlockHolderAnimation.setAnimationListener(new AnimationListener(){
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
homeTabBar.setVisibility(View.GONE);
}
});
tabBlockHolderAnimation.setFillAfter(true);
homeTabBar.startAnimation(tabBlockHolderAnimation);
Run Code Online (Sandbox Code Playgroud) 我有一个有趣的问题,即在Div中显示和隐藏DIV.我正在尝试创建用户体验,以便当鼠标悬停主div时,会出现一个带有删除和更新图标的小div.如果我使用Show/Hide而不使用"Slow"选项,它的效果非常好但是当我使用"Slow"选项时,即使鼠标距离主div很远,它也会开始出现并隐藏每次鼠标两次事件.如果鼠标停留在div上,那么出现和消失的显示将继续显示.到目前为止我收集了什么,显示div时鼠标输出事件被触发,现在问题是如何控制这个?以下是我的代码:
使用Javascript:
function ShowCurrProblemSaveDiv(id){
$(id).find('div').show('slow');
}
function HideCurrProblemSaveDiv(id){
$(id).find('div').hide('slow');
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div id="PatCurrVisitProblemListDiv"
onMouseOver="ShowCurrProblemSaveDiv(this)"
onMouseOut="HideCurrProblemSaveDiv(this)">
<div id="PatCurrVisitProblemSaveDiv"
style="background:red;
display:none;">
Delete-Update Icons
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我只是将这个剧本放在一起,但是它有一个问题,如果图像位于文本之间,当它不可见时它保持高度差异,任何人都有关于如何折叠大小或任何类似于show /在隐瞒什么?
身体
a onclick="showImage();"> Click here</a>
img id="loadingImage" src="image.png" style="visibility:hidden"/>
Run Code Online (Sandbox Code Playgroud)
脚本
function showImage(){
var toggleImage = document.getElementById("loadingImage");
if(toggleImage.style.visibility == "visible") {
document.getElementById('loadingImage').style.visibility='hidden';
}else{
document.getElementById('loadingImage').style.visibility='visible';
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个图像,根据容器的当前高度/宽度以编程方式调整大小.我的问题是它在调整大小之前显示图像的原始大小.
看到这个JSFiddle
您会注意到它如何在拉伸图像闪烁之前如何在中间很好地适应图像.
我希望隐藏图像,直到调整大小,但我无法弄清楚如何.
有什么建议?
JSCode:
function LoadImg(img) {
img.css('visibility','hidden');
var src=img.attr('src');
var imgh = img.parent().height();
var imgw = img.parent().width();
var pattern = /&?(w|h)=[^&]+/g;
src = src.replace(pattern, '');
img.attr('src', src + '&w=' + imgw + '&h=' + imgh);
img.css('visibility','');
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div class="window">
<img src="http://www.angclassiccarparts.co.uk/image_anysize.aspx?f=/images/ww/panel/service_kits.jpg&w=154&h=154&color=png" id="img" onload="LoadImg($(this));" />
</div>
Run Code Online (Sandbox Code Playgroud)
我试图隐藏可见性隐藏,直到函数运行,但不等待它加载...
我试图根据用户是选择电话还是电子邮件单选按钮来隐藏或显示联系人表单的电子邮件/电话号码部分,但是我无法弄清楚为什么它对我不起作用。我已经搜索了堆栈溢出和w3Schools,并且可以确定我使用的是正确的语法,但根据单选按钮,它仍然不会显示/隐藏。任何帮助将不胜感激!
的HTML
<form name="contactForm" id="contactForm" method="post" action="result.php">
<fieldset>
<!-- Client's contact details -->
<legend>Contact Details</legend>
<label for="fullname">Full Name:</label>
<input type="text" name="contact" id="fullname" required>
<label>Preferred contact method:</label>
<input type="radio" name="contact" value="rdoPhone" id="rdoPhone" checked="checked" onclick="cPhone()" >Phone
<input type="radio" name="contact" value="rdoEmail" id="rdoEmail" onclick="cEmail()" >Email
<label for="phonenumber">Phone Number:</label>
<input type="text" name="contact" id="phonenumber">
<label for="email">Email:</label>
<input type="text" name="contact" id="email">
</fieldset>
</form>
Run Code Online (Sandbox Code Playgroud)
的CSS
#email {
display:none;
}
#phonenumber {
display:none;
}
Run Code Online (Sandbox Code Playgroud)
Java脚本
function cPhone() {
if (document.getElementById("rdoPhone").checked)
{ document.getElementById("phonenumber").style.display = "block"; }
}
function cEmail(){
if …Run Code Online (Sandbox Code Playgroud) 我一直在使用这些标志SYSTEM_UI_FLAG_FULLSCREEN并SYSTEM_UI_FLAG_HIDE_NAVIGATION隐藏和显示状态栏和导航栏。他们工作正常。我在活动开始时将它们隐藏起来,我想在触摸事件中再次显示它们。Android会在第一次触摸事件时自动显示它们(此第一次触摸事件不会传递给我的应用程序)。我想sendMessageDelayed()在一段时间后用来隐藏两个栏。我如何使用此首次触摸事件?
我正在尝试显示/隐藏TextView.因此,如果用户从左向右滑动,它将从"橙色渐变视图"后面显示TextView.在显示的文字后,5秒后,它将再次隐藏它,如下图所示:
但我不知道如上所述实施的最佳实践是什么.请帮忙.
show-hide ×10
jquery ×4
android ×3
javascript ×3
css ×2
html ×2
animation ×1
asp.net ×1
collapse ×1
forms ×1
image ×1
iphone ×1
layout ×1
menu ×1
radio-button ×1
ruby ×1
textview ×1
uiimageview ×1
uiscrollview ×1
view ×1