我正在研究Sencha Touch ipad应用程序,该应用程序从JSON提要中提取内容.JSON包含一些图像,以及来自Youtube和Vimeo的一些视频URL.
我在哪里开始尝试在应用中播放嵌入视频?
我想从锚标记中隐藏的标题字段中获取我的Magnific图像的标题 - 而不是标题.这是因为我的标题包含标记.
HTML
<a href="img/zoom.jpg">
<img src="img/small.jpg" alt="">
<span class="hide">This is a caption with <a href="#">a link</a> in it</span>
</a>
Run Code Online (Sandbox Code Playgroud)
JS
// initialise the magnific lightbox
$('.js-lightbox').each(function() {
$(this).magnificPopup({
delegate: 'a',
type: 'image',
tLoading: 'Loading image #%curr%...',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
image: {
titleSrc: function(item) {
return item.el.text;
},
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
}
});
}); …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用coffeescript 模拟这个异步加载的地图.
这是我的coffeescript:
initialize = ->
mapOptions =
zoom: 8
center: new google.maps.LatLng(-34.397, 150.644)
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions)
return
loadScript = ->
script = document.createElement("script")
script.type = "text/javascript"
script.src = "https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&" + "callback=initialize"
document.body.appendChild script
return
$(window).load ->
loadScript()
Run Code Online (Sandbox Code Playgroud)
编译为:
(function() {
var initialize, loadScript;
initialize = function() {
var map, mapOptions;
mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644)
};
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
};
loadScript = function() {
var script;
script = document.createElement("script"); …Run Code Online (Sandbox Code Playgroud) 我正在尝试将一个类添加到一个锚中,如果它包含一个图像 - 但是它将类添加到每个锚中,无论如何:
$(".entry-content a").each( function(i, link) {
if ($(link).has("img")) {
$(link).addClass("fancybox");
}
});
Run Code Online (Sandbox Code Playgroud) 我正在制作一个有基本图像推子的主页:
<div id="cycle">
<img src="/images/bath.jpg">
<img src="/images/desk.jpg">
<img src="/images/car.jpg">
</div>
Run Code Online (Sandbox Code Playgroud)
在文档的底部,我有一些jQuery:
jQuery(document).ready(function($){
if ($(window).width() > 480) {
$('#cycle').fadeIn(4000).cycle({
timeout: 8000,
speed: 4000
});
}
});
Run Code Online (Sandbox Code Playgroud)
因此,如果屏幕宽度大于480px,我只希望运行此脚本.这是最好的方法吗?我想我可以.cycle使用媒体查询隐藏div,但我不希望脚本在后台执行它的操作.
是.cycle调整大小使用div 的唯一方法:
$(window).resize(function() {});
Run Code Online (Sandbox Code Playgroud)
?
javascript ×2
jquery ×2
asynchronous ×1
coffeescript ×1
css ×1
google-maps ×1
html5 ×1
html5-video ×1
ipad ×1
sencha-touch ×1
video ×1