HTML5拖放,还是JqueryUI拖放?(HTML5 Drag and Drop, Or JqueryUI Drag and Drop?)
我正在开发一个客户端应用程序。 它不需要跨浏览器。 而且我想使用拖放功能。
我熟悉JqueryUI拖放,但我想知道哪一个在性能和编程方面更好,Html5或JqueryUI?
谢谢
I'm developing a client-side application. It doesn't need to be cross-browser. And also I wanna use drag and drop feature.
I'm familiar with JqueryUI Drag and drop, But I wanna know which one is better in performance and easy programming, Html5, or JqueryUI?
thx
原文:https://stackoverflow.com/questions/10378721
最满意答案
正如您已经想到的那样,看起来代码执行时无法识别播放器元素。 当模块第一次加载时,DOM肯定没有准备好。 在activate()回调函数期间甚至可能没有准备好。 设置jwplayer的正确时间可能在viewAttached()回调中。
您可以在Composition Callbacks部分中阅读有关viewAttached回调的更多信息: http ://durandaljs.com/documentation/Hooking-Lifecycle-Callbacks/
像这样的东西:
define(['jwplayer/jwplayer','durandal/plugins/router','durandal/app'], function (jwplayer,router,app) { return { router: router, activate: function () { ... }, viewAttached: function(){ jwplayer.api('player').setup({ width: '320', height: '40', sources: [{ file: "rtmp://127.0.0.1:1935/vod/mp3:sample_1.mp3" },{ file: "http://127.0.0.1:1935/vod/sample_1.mp3/playlist.m3u8" }] }); } }; });
As you already figured out, it looks like the player element isn't recognized when the code is executing. When the module is loading for the first time, the DOM definitely isn't ready. It may not even be ready during the activate() callback function. The right time to setup the jwplayer is probably in the viewAttached() callback.
You can read more about the viewAttached callback here in the Composition Callbacks section: http://durandaljs.com/documentation/Hooking-Lifecycle-Callbacks/
Something like this:
define(['jwplayer/jwplayer','durandal/plugins/router','durandal/app'], function (jwplayer,router,app) { return { router: router, activate: function () { ... }, viewAttached: function(){ jwplayer.api('player').setup({ width: '320', height: '40', sources: [{ file: "rtmp://127.0.0.1:1935/vod/mp3:sample_1.mp3" },{ file: "http://127.0.0.1:1935/vod/sample_1.mp3/playlist.m3u8" }] }); } }; });
相关问答
更多-
好的答案很简单......我只给了div个人名字: 例如:Loading the player ...Durandal根据需要加载视图和视图模型(按需)。 因此,在您的示例中,使用100个视图和视图模型,您只能加载您使用的视图。 观看浏览器工具的“网络”标签,您可以根据需要看到它们。 此外,一旦它们是本地的,它们被缓存在浏览器中,这是一件好事。 如果您的viewmodel使数据调用为“activate”,则为yes,每次激活它们时都会调用它们。 有关生命周期事件的更多信息,请参阅Durandal文档。 但是,如果您运行optimizer.exe,它将打包所有这些并将它们预先一次性(缩小)带到客户端。 这不是 ...
动态加载JWplayer(Loading JWplayer dynamically)[2022-09-21]
这似乎工作正常: $("#result").html("Preview video
"); 我认为这是一个双/单引号问题。 一切都恢复正常。 This seems to work fine: $("#result").html("JWPlayer的灯箱效果(Lightbox effect for JWPlayer)[2021-08-21]
我设法使用Lightbox Plus插件的内联灯箱设置功能,如下所述: http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/27431/running-jw-player-in-a-lightbox I managed to get this working using the inline lightbox settings feature of the Lightbox Plus plugin, ...看起来JW5不支持捕获YouTube错误。 但是,JW6的以下设置有效:YouTube Test Page Multipl ... 欢迎加入,并确保浏览http://durandaljs.com/pages/docs/上的文档,该文档提供了一个很好的概述。 当查看允许DOM片段组合的Durandal特征时,我通常会区分单个视图模型(唯一的,只有一个)或构造函数(可能是一个或多个)。 按照惯例,视图模型与同名的* .html文件配对。 例如,看看Durandal的示例shell.html与JumpStarter的shell.html中的shell.html 在两个示例中, shell.js返回一个单例,因为只有一个shell,但第二个示例 ...正如您所指出的,Durandal将忽略视图中的script标记。 它们仅从index.html (或其等价物)加载。 您是否能够提前引用脚本(和noscript),将它们放在index.html文件中? 换句话说,它们是否必须动态加载? 旁注:你在“main.js中引用了我所有的其他脚本”是什么意思? 你的意思是它们是RequireJS的路径配置吗? 或者你的意思是说它们在index.html文件(或其等价物)中被引用? After much research I found my answer final ...相关文章
更多- HTML5 Drag and Drop【HTML5教程 - 第六篇】
- HTML5 入门文章目录汇总
- HTML5+Springmvc实现拖拽文件上传
- HTML5 Web SQL Database 数据库
- HTML5项目笔记5:使用HTML5 WebDataBase设计离线数据库
- mysql删除外键(Cannot drop index 'FK7D676EBBD0A6D8FD': needed in a foreign key constraint)
- jqueryUI插件视频教程01_简介和样式操作
- 孔浩JQuery、jqueryUI、jquery validate、comet视频教程
- HTML5 Video元素【HTML5教程 - 第三篇】
- HTML5 Geolocation【HTML5教程 - 第十篇】
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。