使用json从tumblr获取图像并将其显示到jQuery滑块中?
正如标题所说,我需要从tumblr博客获取图像并将其显示在网站的滑块中,我已经成功地使用jsnon从tumblr获取了图像,但现在我需要将它们放入这个jQuery滑块中。() 所以我认为这可能会起作用,但没有人知道我要做什么 任何帮助都是有用的!多谢各位使用json从tumblr获取图像并将其显示到jQuery滑块中?,jquery,json,slider,tumblr,image-gallery,Jquery,Json,Slider,Tumblr,Image Gallery,正如标题所说,我需要从tumblr博客获取图像并将其显示在网站的滑块中,我已经成功地使用jsnon从tumblr获取了图像,但现在我需要将它们放入这个jQuery滑块中。() 所以我认为这可能会起作用,但没有人知道我要做什么 任何帮助都是有用的!多谢各位 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ResponsiveSlides.js &a
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ResponsiveSlides.js · Responsive jQuery slideshow</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="../responsiveslides.css">
<link rel="stylesheet" href="demo.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="../responsiveslides.min.js"></script>
<script>
// You can also use "$(window).load(function() {"
$(function () {
// Slideshow 1
$("#slider1").responsiveSlides({
maxwidth: 800,
speed: 800
});
// Slideshow 2
$("#slider2").responsiveSlides({
auto: false,
pager: true,
speed: 300,
maxwidth: 540
});
// Slideshow 3
$("#slider3").responsiveSlides({
manualControls: '#slider3-pager',
maxwidth: 540
});
// Slideshow 4
$("#slider4").responsiveSlides({
auto: false,
pager: false,
nav: true,
speed: 500,
namespace: "callbacks",
before: function () {
$('.events').append("<li>before event fired.</li>");
},
after: function () {
$('.events').append("<li>after event fired.</li>");
}
});
});
</script>
ResponsiveSlides.js和middot;响应jQuery幻灯片
//您还可以使用“$(window).load(function(){”
$(函数(){
//幻灯片1
$(“#幻灯片1”)。响应幻灯片({
最大宽度:800,
速度:800
});
//幻灯片2
$(“#幻灯片2”)。响应幻灯片({
汽车:错,
寻呼机:是的,
速度:300,,
最大宽度:540
});
//幻灯片3
$(“#幻灯片3”)。响应幻灯片({
手动控制:“#滑块3传呼机”,
最大宽度:540
});
//幻灯片4
$(“#幻灯片4”)。响应幻灯片({
汽车:错,
传呼机:错,
导航:是的,
速度:500,,
名称空间:“回调”,
前:函数(){
$('.events')。追加(在事件激发之前。 );
},
之后:函数(){
$('.events')。在激发事件后追加(。 );
}
});
});
ResponsiveSlides.js
简单轻巧的响应幻灯片播放插件(1kb)
- 示例4回调事件
嘿,我现在正试图用js/jquery实现这一点。什么都不起作用吗?你从tumblr帐户中获得了图像吗?你能检查一下响应吗?嘿@lharby我真的做到了,如果你还需要帮助,让我知道嘿,是的,我有不同的版本在工作,但从未从tumblr和加载它们,我认为是因为API的v1和v2。
<?php
// don't forget to change 'username' to your actual tumblr name
$request = 'http://dafuckinblondie.tumblr.com/api/read/json';
$ci = curl_init($request);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
$input = curl_exec($ci);
// Tumblr JSON doesn't come in standard form, some str replace needed
$input = str_replace('var tumblr_api_read = ','',$input);
$input = str_replace(';','',$input);
// parameter 'true' is necessary for output as PHP array
$value = json_decode($input, true);
$content = $value['posts'];
// the number of items you want to display
$item = 50;
// Tumblr provides various photo size, this case will choose the 75x75 square one
$type = 'photo-url-500';
for ($i=0;$i<=$item;$i++) {
if ($content[$i]['type'] == 'photo') {
$fotos ='<img src="' . $content[$i][$type] . '" width="500" hspace="3" alt="' . $content[$i][''] . '" >';
}
}
?>
<body>
<div id="wrapper">
<h1>ResponsiveSlides.js</h1>
<h2>Simple & lightweight responsive slideshow plugin (in 1kb)</h2>
<!-- Slideshow 1 -->
<ul class="rslides" id="slider1">
<li><?php echo '<img src="' . $fotos . '">' ?> </li>
</ul>
<!-- This is here just to demonstrate the callbacks -->
<ul class="events">
<li><h3>Example 4 callback events</h3></li>
</ul>
<a href="http://responsiveslides.com/" id="download">See the documentation</a>
<p class="footer">ResponsiveSlides.js is created by <a href="http://viljamis.com">@viljamis</a>. It's released under the MIT license. If you have any questions or feedback you can use the <a href="https://github.com/viljami/ResponsiveSlides.js">GitHub project page</a>.</p>
</div>
</body>
</html>