我有一个跨度的div
<div id="div1">
<span class="">hello</span>
</div>
Run Code Online (Sandbox Code Playgroud)
当我点击div我想改变div的第一个span元素的类
$('#div1').click(function() {
// ... check if first span element inside the div .. if there and change the class..
});
Run Code Online (Sandbox Code Playgroud) 我正在开发一个主要用于ipad的jquery组件.所以无论如何都要在桌面上模拟'touchstart和'touchend'事件,而不是让设备本身来检查事件.
我基本上试图从event.target获取目标元素,如果不是相同的进程.我怎样才能得到以下的东西?
$(document).ready(function(){
$(document).click(function(event) {
if(event.target!='#contents') { //If clicked element is not div #contents show alert .. //How can i achieve this ?
alert("..");
}
});
});
Run Code Online (Sandbox Code Playgroud) 我是ruby中的菜鸟,我正在尝试在ubuntu 12.04上设置Ruby on Rails.我正按照本网站提供的步骤进行操作https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-与-RVM
但每当我尝试运行此命令> rvm rubygems current我都会收到错误
"检索rubygems-没有' http://production.cf.rubygems.org/rubygems/rubygems-.tgz '或'rubygems-.tgz'的校验和,它无法验证它.如果你想继续未验证的下载命令后添加'--verify-downloads 1'."
关于如何进行的任何帮助.
我正在使用HTML5日期选择器.选择日期后,ng-model显示较旧的日期,而不是选择的当前日期.
<input type="date" ng-model="dateModel" />
Run Code Online (Sandbox Code Playgroud)
当我选择当前日期时,ng-model有2015-05-13T18:30:00.000Z而不是2015-05-14.如果我在jQuery中使用它,它将正确存储为2015-05-14
我该如何解决这个问题?
Plunker - AngularJS
Plunker - jQuery
我有一个div包含文本和图像以及ul li及以下的文本详细信息是html结构.我已经将溢出应用于类.sbox,但它似乎不起作用,文本细节似乎没有被隐藏和溢出.
JSFiddle - http://jsfiddle.net/SAN6n/
<div id="content" class="contentList">
<ul id="slist" class="storyList">
<li>
<div id="storyBox1" class="sbox">
<div class="boxContent" >
<span class="overlay"><h5>Picture1 </h5></span>
<div class="txtOverlay"><h3>This is spring and weather looks good ...</h3</div>
<span><img src="http://img13.imageshack.us/img13/38/picture11tp.jpg"/></span>
</div>
</div>
</li>
</ul>
</div>?
Run Code Online (Sandbox Code Playgroud)
.storyList {
width:100%;
height:100%;
}
.sbox {
float:left;
width:300px;
height:150px;
padding: 5px 7px 8px 5px;
margin-top:20px;
margin-right:40px;
background:white;
border:1px solid #DDD;
<!--border radius-->
-webkit-border-radius: 3px;
-moz-border-radius: 2px;
border-radius: 3px;
overflow: hidden;
}
.boxContent {
width:100%;
height:100%;
border: 1px solid #777;
} …Run Code Online (Sandbox Code Playgroud) 我隐藏了一个li,在隐藏它之后,html中还留有一个空隙,我想重新装载砌体并重新安排内容.我试过.masonry('reload'),但我没有工作.任何帮助
小提琴 http://jsfiddle.net/emtBX/1/
JS
$(document).ready(function(){
$('#container').masonry({
// options
itemSelector : '.item',
columnWidth : 240,
isAnimated: true,
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
}
});
$('#butn1').click(function() {
$('#container ul li').eq(2).hide();
$('#container').masonry('reload');
});
});
Run Code Online (Sandbox Code Playgroud) 我使用Backbone LayoutManager在应用程序中管理我的视图.我想尝试木偶.我遇到了一个问题,我无法将视图添加到某个区域.
<body>
<div id="content">
<header id="header"></header>
<div id="wrapper">
<span>Some View Content</span>
</div>
<footer id="footer"></footer>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
MyApp = new Backbone.Marionette.Application();
var rm = new Marionette.RegionManager();
var regions = rm.addRegions({
mainRegion : '#content',
headerRegion : '#header',
wrapperRegion : '#wrapper',
footerRegion : '#footer'
});
regions.headerRegion.show(new HeaderView());
regions.wrapperRegion.show(new SomeView());
regions.footerRegion.show(new FooterView());
Run Code Online (Sandbox Code Playgroud)
如果我想在wrapperRegion中追加另一个视图怎么做呢?
我还想知道有没有办法在我现有的视图中插入另一个视图?布局管理器允许我写下面提到的代码..如何在牵线木偶中实现这样的事情?
var MyView = Backbone.View.extend({
tagName: "div",
beforeRender: function() {
this.insertView(new ItemView());
}
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用momentjs以下面的方式将系统日期转换为ISO格式
2015-02-17T19:05:00.000Z
Run Code Online (Sandbox Code Playgroud)
然而,我无法找到我需要使用的参数来获取我想要的格式.我尝试下面的代码..
moment().format("YYYY-MM-DD HH:mm Z");
Run Code Online (Sandbox Code Playgroud)
我输出为2015-02-02 17:24 + 05:30.
我怎么能得到2015-02-02T17:24:00.000Z
我正在对象上做一个简单的slideUp动画.我希望在动画完成后向元素添加属性标记.我怎样才能使这个工作?
if($(this).is(':visible')) {
if(config.animate=='true')
$(this).slideUp(options.animationTime); //After animation ends do $(this).attr('shown','true');
else
$(this).hide();
}
Run Code Online (Sandbox Code Playgroud) jquery ×5
javascript ×3
html ×2
angularjs ×1
backbone.js ×1
css ×1
datetime ×1
marionette ×1
momentjs ×1
rubygems ×1
rvm ×1
touch ×1
touch-event ×1