<div class="container-fluid text-center">
<h1>
Random Quote Generator
</h1>
<div class="well quote-area">
<span class="quote">
</span>
<span class="author">
</span>
</div>
<div class="btns">
<button class="btn btn-default btn-lg" id="tweet">
<i class="fa fa-twitter" aria-hidden="true">
</i>
Tweet
</button>
<button class="btn btn-default btn-lg" id="weibo">
<i class="fa fa-weibo" aria-hidden="true">
</i>
Weibo
</button>
<button class="btn btn-default btn-lg" id="change">
<i class="fa fa-exchange" aria-hidden="true">
</i>
Get Quote
</button>
</div>
</div>
<footer class="text-center">
Designed by
<a href="http://blog.csdn.net/alenhhy" rel="external nofollow" target="_blank">
Alen Hu
</a>
</footer>
$(document).ready(function() {
var quote, author;
function getNewQuote() {
$.ajax({
type: "get",
url: "http://api.forismatic.com/api/1.0/",
jsonp: 'jsonp',
dataType: 'jsonp',
data: {
method: 'getQuote',
lang: 'en',
format: 'jsonp'
},
success: function(response) {
quote = response.quoteText;
author = response.quoteAuthor;
$('.quote').text('\"' + quote + '\"');
if (author) {
$('.author').text('by ' + author);
} else {
$('.author').text('by Unknown');
}
}
});
}
getNewQuote();
$('#change').on('click',
function(event) {
event.preventDefault();
getNewQuote();
});
$('#tweet').on('click',
function(event) {
event.preventDefault();
window.open('http://twitter.com/intent/tweet?text=' + encodeURIComponent(quote + ' by ' + author));
});
$('#weibo').on('click',
function(event) {
event.preventDefault();
window.open('http://v.t.sina.com.cn/share/share.php?title=' + encodeURIComponent(quote + ' by ' + author));
})
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有