我正在处理单击元素时播放不同视频的页面.虽然它在计算机上运行得很漂亮,但iOS设备却没有.问题是当点击元素(在这种情况下是一个按钮)时,它会显示视频但不会开始播放,因为它应该如此.脚本是
$(document).ready(function(){
$('#video_1, #video_2').hide();
$('.icon_1').click(function(){
$('#video_2').fadeOut(function(){
$('#video_1').fadeIn();
});
});
$('.icon_2').click(function(){
$('#video_1').fadeOut(function(){
$('#video_2').fadeIn();
});
});
$('.icon_1').click(function(){
$('.video_2').get(0).pause();
$('.video_2').get(0).currentTime = 0;
$('.video_1').get(0).play();
});
$('.icon_2').click(function(){
$('.video_1').get(0).pause();
$('.video_1').get(0).currentTime = 0;
$('.video_2').get(0).play();
});
});
Run Code Online (Sandbox Code Playgroud)
和HTML是
<button><div class="icon_1" id="mediaplayer" onclick="play">cadillac</div></button>
<button><div class="icon_2" id="mediaplayer2" onclick="play">nike</div></button>
<div id="video_1">
<video class="video_1" width="50%" height="50%" controls poster="http://www.birds.com/wp-content/uploads/home/bird.jpg" >
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type="video/mp4" />
</video>
</div>
<div id="video_2">
<video class="video_2" width="50%" height="50%" controls poster="images/BKG_JohnGT.png">
<source src="images/01.mp4" type="video/mp4" />
</video>
?</div>
Run Code Online (Sandbox Code Playgroud)
任何人都可以给我一个可以让这种情况发生的功能,那会很棒
在文档中,您似乎可以通过将参数传递给文本字段上的click事件来阻止冒泡:
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.TextField-event-click
使用他们的新Alloy框架,我有一个像这样声明的文本字段:
<TextField id='name' onClick='doStuff' />
Run Code Online (Sandbox Code Playgroud)
在我的控制器中我有这个功能:
function doStuff(e) {
alert('hello');
}
Run Code Online (Sandbox Code Playgroud)
但是,此元素包含在一个容器元素中,该元素也有一个onClick事件,我想在单击文本字段时阻止该元素触发.我怎么能做到这一点?
我正在尝试:
Application Mobile with Alloy
Titanium SDK version: 2.1.3 (10/02/12 16:16 15997d0)
iPhone Device family: universal
iPhone SDK version: 6.0
iPhone simulated device: iphone
Detected compiler plugin: ti.alloy/1.0
Run Code Online (Sandbox Code Playgroud)
我创造了两个模型:
alloy generate model met sql met_id:int libelle:string famille_id:int
alloy generate model famille sql famille_id:int libelle:string
Run Code Online (Sandbox Code Playgroud)
并填写以下数据:
var mets = Alloy.createCollection('Met')
var met = Alloy.createModel("Met",{met_id:1,libelle:"Salade de Chèvre Chaud",famille_id:1});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:2,libelle:"Salade de Chèvre Chaud",famille_id:2});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:3,libelle:"Salade de Chèvre Chaud",famille_id:3});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:4,libelle:"Salade de Chèvre Chaud",famille_id:4});mets.add(met);met.save();
var met = …Run Code Online (Sandbox Code Playgroud) 我是钛合金的新手,我想将我的项目从钛默认模板改为合金.以下是在默认模板中创建文本框的代码.我想将其更改为合金模板.
var checkbox = Ti.UI.createSwitch({
id:'checkbox',
style:Ti.UI.Android.SWITCH_STYLE_CHECKBOX,
});
Run Code Online (Sandbox Code Playgroud) 如何在XML中进行网格布局.例如,说我想要一个4x4板.我只需要制作16个按钮并使用jss格式化它们吗?例如,这就是我所拥有的,但尚未采用板格式.
<Alloy>
<Window layout="relative" backgroundColor="white">
<Button class="button left-buttons">square</Button>
<Button class="button left-buttons" top="40">square</Button>
<Button class="button left-buttons" top="80">square</Button>
<Label id="User" left="100" top="120" text=">(NULL)<"></Label>
<Button class="button right-buttons" >square</Button>
<Button class="button right-buttons" top="40">square/square</Button>
<Button class="button right-buttons" top="80">square</Button>
<Button class="Games" top="200">square</Button>
<Button class="Games" top="280">square</Button>
<Button top="360">square</Button>
</Window>
</Alloy>
Run Code Online (Sandbox Code Playgroud) 我在Titanium上使用Alloy MVC框架,并希望在视图之间进行幻灯片放映.当我在屏幕上滑动时,我想显示下一个/上一个视图,其中包含从右到左或从左到右的滑动效果.我正在使用此代码:
我的index.xml中的一个标签:
<Tab title="Bilan" icon="KS_nav_ui.png">
<Window title="Bilan" id="bilanTab" onSwipe="doBilanSwipe">
</Window>
</Tab>
Run Code Online (Sandbox Code Playgroud)
在bilanTab中动态添加和填充问题视图:
<Alloy>
<Collection src="ReponsePossible">
<View id="questionContainer" class="container">
<Label id="questionText" />
<Button id="buttonNextQuestion">Question suivante</Button>
</View>
</Alloy>
Run Code Online (Sandbox Code Playgroud)
和index.js控制器里面的两个函数(在这里没有打印出来的3个函数):
var previousQuestion;
var nextQuestion;
function doBilanSwipe(e){
if (e.direction == 'left'){
nextQuestion();
}
else if (e.direction == 'right'){
prevQuestion();
}
}
function nextQuestion(){
if (questionsCurrentIndex < questions.length-1){
questionsCurrentIndex++;
$.previous = previousQuestion;
$.next = Alloy.createController('question', questions.at(questionsCurrentIndex));
nextQuestion = $.next;
$.next.questionContainer.left = 320;
$.bilanTab.add($.next.questionContainer);
$.next.questionContainer.animate({left:0, duration:200});
$.previous.questionContainer.animate({left:-320, duration:200},function(){
$.previous = previousQuestion;
$.next = nextQuestion;
$.bilanTab.remove($.previous.questionContainer); …Run Code Online (Sandbox Code Playgroud) titanium ×4
appcelerator ×2
javascript ×2
android ×1
animation ×1
backbone.js ×1
html5 ×1
ios ×1
ios5 ×1
jquery ×1
sdk ×1
video ×1
view ×1
xml ×1