- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
用于推文当前报价的 jQuery 单击功能不起作用。我必须构建随机报价机并在 Twitter 上发布 Free Code Camp 的当前报价。我可以生成新报价,但无法在 Twitter 上分享该报价。有人会告诉我我做错了什么吗?
我的代码位于此处:FCC Random Quote Machine
$(document).ready(function() {
generate();
function generate(){
var quotes = [
'If you want to achieve greatness stop asking and for permission. @Anonymous',
'Things work out best for those who make the best of how things work out. @John Wooden',
'To live a creative life, we must lose our fear of being wrong. @Anonymous',
'If you are not willing to risk the usual you will have to settle for the ordinary. @Jim Rohn',
'Trust because you are willing to accept the risk, not because it\'s safe or certain. @Anonymous',
'Take up one idea. Make that one idea your life - think of it, dream of it, live on that idea. Let the brain, muscles, nerves, every part of your body, be full of that idea, and just leave every other idea alone. This is the way to success. @Swami Vivekananda',
'All our dreams can come true if we have the courage to pursue them. @Walt Disney',
'Good things come to people who wait, but better things come to those who go out and get them. @Anonymous',
'If you do what you always did, you will get what you always got. @Anonymous',
'Success is walking from failure to failure with no loss of enthusiasm. @Winston Churchill',
'Just when the caterpillar thought the world was ending, he turned into a butterfly. @Proverb',
'Successful entrepreneurs are givers and not takers of positive energy. @Anonymous',
'Whenever you see a successful person you only see the public glories, never the private sacrifices to reach them. @Vaibhav Shah',
'Opportunities don\'t happen, you create them. @Chris Grosser',
'Try not to become a person of success, but rather try to become a person of value. @Albert Einstein',
'Great minds discuss ideas; average minds discuss events; small minds discuss people. @Eleanor Roosevelt',
'I have not failed. I\'ve just found 10,000 ways that won\'t work. @Thomas A. Edison',
'If you don\'t value your time, neither will others. Stop giving away your time and talents - start charging for it. @Kim Garst',
'A successful man is one who can lay a firm foundation with the bricks others have thrown at him. @David Brinkley',
'No one can make you feel inferior without your consent. @Eleanor Roosevelt',
'The whole secret of a successful life is to find out what is one\'s destiny to do, and then do it. @Henry Ford',
'If you\'re going through hell keep going. @Winston Churchill',
'The ones who are crazy enough to think they can change the world, are the ones who do. @Anonymous',
'Don\'t raise your voice, improve your argument. @Anonymous',
'What seems to us as bitter trials are often blessings in disguise. @Oscar Wilde',
'The meaning of life is to find your gift. The purpose of life is to give it away. @Anonymous',
'The distance between insanity and genius is measured only by success. @Bruce Feirstein',
'When you stop chasing the wrong things, you give the right things a chance to catch you. @Lolly Daskal',
'I believe that the only courage anybody ever needs is the courage to follow your own dreams. @Oprah Winfrey',
'No masterpiece was ever created by a lazy artist. @Anonymous',
'Happiness is a butterfly, which when pursued, is always beyond your grasp, but which, if you will sit down quietly, may alight upon you. @Nathaniel Hawthorne',
'If you can\'t explain it simply, you don\'t understand it well enough. @Albert Einstein',
'Blessed are those who can give without remembering and take without forgetting. @Anonymous',
'Do one thing every day that scares you. @Anonymous',
'What\'s the point of being alive if you don\'t at least try to do something remarkable. @Anonymous',
'Life is not about finding yourself. Life is about creating yourself. @Lolly Daskal',
'Nothing in the world is more common than unsuccessful people with talent. @Anonymous',
'Knowledge is being aware of what you can do. Wisdom is knowing when not to do it. @Anonymous',
'Your problem isn\'t the problem. Your reaction is the problem. @Anonymous',
'You can do anything, but not everything. @Anonymous',
'Innovation distinguishes between a leader and a follower. @Steve Jobs',
'There are two types of people who will tell you that you cannot make a difference in this world: those who are afraid to try and those who are afraid you will succeed. @Ray Goforth',
'Thinking should become your capital asset, no matter whatever ups and downs you come across in your life. @A.P.J. Abdul Kalam',
'I find that the harder I work, the more luck I seem to have. @Thomas Jefferson',
'The starting point of all achievement is desire. @Napoleon Hill',
'Success is the sum of small efforts, repeated day-in and day-out. @Robert Collier',
'If you want to achieve excellence, you can get there today. As of this second, quit doing less-than-excellent work. @Thomas J. Watson',
'All progress takes place outside the comfort zone. @Michael John Bobak',
'You may only succeed if you desire succeeding; you may only fail if you do not mind failing. @Philippos',
'Courage is resistance to fear, mastery of fear - not absence of fear. @Mark Twain',
'Only put off until tomorrow what you are willing to die having left undone. @Pablo Picasso',
'People often say that motivation doesn\'t last. Well, neither does bathing - that\'s why we recommend it daily. @Zig Ziglar',
'We become what we think about most of the time, and that\'s the strangest secret. @Earl Nightingale',
'The only place where success comes before work is in the dictionary. @Vidal Sassoon',
'Too many of us are not living our dreams because we are living our fears. @Les Brown',
'I find that when you have a real interest in life and a curious life, that sleep is not the most important thing. @Martha Stewart',
'It\'s not what you look at that matters, it\'s what you see. @Anonymous',
'The road to success and the road to failure are almost exactly the same. @Colin R. Davis',
'The function of leadership is to produce more leaders, not more followers. @Ralph Nader',
'Success is liking yourself, liking what you do, and liking how you do it. @Maya Angelou',
'As we look ahead into the next century, leaders will be those who empower others. @Bill Gates',
'A real entrepreneur is somebody who has no safety net underneath them. @Henry Kravis',
'The first step toward success is taken when you refuse to be a captive of the environment in which you first find yourself. @Mark Caine',
'People who succeed have momentum. The more they succeed, the more they want to succeed, and the more they find a way to succeed. Similarly, when someone is failing, the tendency is to get on a downward spiral that can even become a self-fulfilling prophecy. @Tony Robbins',
'When I dare to be powerful, to use my strength in the service of my vision, then it becomes less and less important whether I am afraid. @Audre Lorde',
'Whenever you find yourself on the side of the majority, it is time to pause and reflect. @Mark Twain',
'The successful warrior is the average man, with laser-like focus. @Bruce Lee',
'There is no traffic jam along the extra mile. @Roger Staubach',
'Develop success from failures. Discouragement and failure are two of the surest stepping stones to success. @Dale Carnegie',
'If you don\'t design your own life plan, chances are you\'ll fall into someone else\'s plan. And guess what they have planned for you? Not much. @Jim Rohn',
'If you genuinely want something, don\'t wait for it - teach yourself to be impatient. @Gurbaksh Chahal',
'Don\'t let the fear of losing be greater than the excitement of winning. @Robert Kiyosaki',
'If you want to make a permanent change, stop focusing on the size of your problems and start focusing on the size of you! @T. Harv Eker',
'You can\'t connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something - your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life. @Steve Jobs',
'Two roads diverged in a wood and I took the one less traveled by, and that made all the difference. @Robert Frost',
'The number one reason people fail in life is because they listen to their friends, family, and neighbors. @Napoleon Hill',
'The reason most people never reach their goals is that they don\'t define them, or ever seriously consider them as believable or achievable. Winners can tell you where they are going, what they plan to do along the way, and who will be sharing the adventure with them. @Denis Waitley',
'In my experience, there is only one motivation, and that is desire. No reasons or principle contain it or stand against it. @Jane Smiley',
'Success does not consist in never making mistakes but in never making the same one a second time. @George Bernard Shaw',
'I don\'t want to get to the end of my life and find that I lived just the length of it. I want to have lived the width of it as well. @Diane Ackerman',
'You must expect great things of yourself before you can do them. @Michael Jordan',
'Motivation is what gets you started. Habit is what keeps you going. @Jim Ryun',
'People rarely succeed unless they have fun in what they are doing. @Dale Carnegie',
'There is no chance, no destiny, no fate, that can hinder or control the firm resolve of a determined soul. @Ella Wheeler Wilcox',
'Our greatest fear should not be of failure but of succeeding at things in life that don\'t really matter. @Francis Chan',
'You\'ve got to get up every morning with determination if you\'re going to go to bed with satisfaction. @George Lorimer',
'A goal is not always meant to be reached; it often serves simply as something to aim at. @Bruce Lee',
'Success is ... knowing your purpose in life, growing to reach your maximum potential, and sowing seeds that benefit others. @John C. Maxwell',
'Be miserable. Or motivate yourself. Whatever has to be done, it\'s always your choice. @Wayne Dyer',
'To accomplish great things, we must not only act, but also dream, not only plan, but also believe. @Anatole France',
'Most of the important things in the world have been accomplished by people who have kept on trying when there seemed to be no help at all. @Dale Carnegie',
'You measure the size of the accomplishment by the obstacles you had to overcome to reach your goals. @Booker T. Washington',
'Real difficulties can be overcome; it is only the imaginary ones that are unconquerable. @Theodore N. Vail',
'It is better to fail in originality than to succeed in imitation. @Herman Melville',
'What would you do if you weren\'t afraid. @Spencer Johnson',
'Little minds are tamed and subdued by misfortune; but great minds rise above it. @Washington Irving',
'Failure is the condiment that gives success its flavor. @Truman Capote',
'Don\'t let what you cannot do interfere with what you can do. @John R. Wooden',
'You may have to fight a battle more than once to win it. @Margaret Thatcher',
'A man can be as great as he wants to be. If you believe in yourself and have the courage, the determination, the dedication, the competitive drive and if you are willing to sacrifice the little things in life and pay the price for the things that are worthwhile, it can be done. @Vince Lombardi'
];
randomQuote = quotes[Math.floor(Math.random()*quotes.length)];
quoteAuthor=randomQuote.split("@");
$('.quote').text(quoteAuthor[0]);
$('.author').text(quoteAuthor[1]);
}
function shareQuote(quote, author) {
var webpage = "http://codepen.io/lindakovacs/pen/EWjyyZ";
var twitterAction = "https://twitter.com/intent/tweet?text=";
$('#tweetBtn').attr("href", twitterAction + quote + " -" + author + " " + webpage);
}
$("#new-quote").on("click", function() {
generate();
});
});
@import url('https://fonts.googleapis.com/css?family=Great+Vibes');
@import url('https://fonts.googleapis.com/css?family=Alex+Brush');
* {
margin: 0px;
padding: 2px;
}
.container{
text-align:center;
}
h1{
font-size: 40px;
font-family: 'Great Vibes', cursive;
color: #4d2700;
display:block;
text-align: center;
width: 80%;
margin: 0px auto;
padding: 10px 0;
}
header a, a:visited {
text-decoration:none;
color:#fcfcfc;
}
.a {
text-decoration:none;
}
.btn-blue {
background-color: #3861EC;
color: #fff;
border: none;
text-decoration:none;
}
body {
background: url('http://www.nyantler-outdoors.com/images/aged-parchment.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.quotes {
font-family: 'Alex Brush', cursive;
font-size: 40px;
font-weight: bold;
margin: 50px auto;
position: relative;
width: 40%;
}
.author {
font-family: 'Alex Brush', cursive;
font-size: 30px;
font-weight: bold;
margin: 50px auto;
width: 40%;
position: relative;
}
.divider {
height: 0.5px;
width: 10%;
margin: 0 auto;
margin-top: 10px;
opacity: 0.5;
position: relative;
background-color: #000000;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Random Quote Machine - Free Code Camp</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Boostrap -->
<link rel='stylesheet prefetch' href='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css'>
<link rel='stylesheet prefetch' href='//cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css'>
<!-- Link styles -->
<link rel="stylesheet" href="css/style.css" />
<link href='//fonts.googleapis.com/css?family=Arizonia' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Alex+Brush' rel='stylesheet' type='text/css'>
<!-- Link scripts -->
<script src="js/script.js"></script>
</head>
<body>
<div class="container text-center">
<h1>Your Daily Dose of Inspiration</h1>
<div class="btn btn-blue text-centre" id="tweetBtn" target="_blank">
<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=" data-size="large"><span class="fa fa-twitter"></span> Tweet</a>
</div>
<div class="btn btn-blue text-centre" id="new-quote" target="_blank"><span class="fa fa-chevron-right"></span> Get inspired
</div>
</div>
<div class="quotes text-center">
<span class="quote"></span><br>
<div class="divider"></div>
<span class="author"></span>
</div>
<footer class="navbar-fixed-bottom text-center">
<div class="fixfooter">
<p id="footer">By Linda Kovacs 2017</p>
</div>
</footer>
</body>
</html>
最佳答案
我弄清楚了如何让我的代码在 Twitter 上分享报价。我还在引号中将 @ 更改为 - :
randomQuote = quotes[Math.floor(Math.random()*quotes.length)];
quoteAuthor=randomQuote.split("-");
quote = $('.quote').text(quoteAuthor[0]);
author = $('.author').text(quoteAuthor[1]);
}
$('#tweetBtn').on('click', function(){
window.open('https://twitter.com/intent/tweet?text='+ randomQuote + ' | A CoDePen by LindaKovacs 2017', 'Share', 'width=700, height=500, toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1');
});
$("#new-quote").on("click", function() {
generate();
});
});
关于javascript - 无法分享包含引用和作者的推文(FCC 随机引用机),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42570260/
我有一个类似于以下的结构。 class A { string title; List bItem; } class B { int pric
本地流 和 远程流 两者都是“媒体流列表 ”。 本地流 包含“本地媒体流 ” 对象 但是,远程流 包含“媒体流 ” 对象 为什么差别这么大? 当我使用“本地流 “- 这个对我有用: localVide
我正在尝试将 8 列虚拟变量转换为 8 级排名的一列。 我试图用这个公式来做到这一点: =IF(OR(A1="1");"1";IF(OR(B1="1");"2";IF(OR(C1="1");"3";I
我正在使用面向对象编程在 Python 中创建一个有点复杂的棋盘游戏的实现。 我的问题是,许多这些对象应该能够与其他对象交互,即使它们不包含在其中。 例如Game是一个对象,其中包含PointTrac
有没有办法获取与 contains 语句匹配的最深元素? 基本上,如果我有嵌套的 div,我想要最后一个元素而不是父元素: Needle $("div:contains('Needle')")
出于某种原因,我无法在 Google 上找到答案!但是使用 SQL contains 函数我怎么能告诉它从字符串的开头开始,即我正在寻找等同于的全文 喜欢 'some_term%'。 我知道我可以使用
我正在尝试创建一个正则表达式来匹配具有 3 个或更多元音的字符串。 我试过这个: [aeiou]{3,} 但它仅在元音按顺序排列时才有效。有什么建议吗? 例如: 塞缪尔 -> 有效 琼 -> 无效 S
嘿所以我遇到了这样的情况,我从数据库中拉回一个客户,并通过包含的方式包含所有案例研究 return (from c in db.Clients.Include("CaseStudies")
如果关键字是子字符串,我无法弄清楚为什么这个函数不返回结果。 const string = 'cake'; const substring = 'cak'; console.log(string.in
我正在尝试将包含特定文本字符串的任何元素更改为红色。在我的示例中,我可以将子元素变为蓝色,但是我编写“替换我”行的方式有些不正确;红色不会发生变化。我注意到“contains”方法通常写为 :cont
我想问一下我是否可以要求/包含一个语法错误的文件,如果不能,则require/include返回一个值,这样我就知道所需/包含的文件存在语法错误并且不能被要求/包含? file.php语法错误 inc
我想为所有包含youtube链接的链接添加一个rel。 这就是我正在使用的东西-但它没有用。有任何想法吗? $('a [href:contains(“youtube.com”)]')。attr('re
我正在尝试在 Elasticsearch 中查询。除搜索中出现“/”外,此功能均正常运行。查询如下所示 GET styling_rules/product_line_filters/_search {
我正在开发名为eBookRepository的ASP.NET MVC应用程序,其中包含在线图书。 电子书具有自己的标题,作者等。因此,现在我正在尝试实现搜索机制。我必须使用Elasticsearch作
我已阅读Firebase Documentation并且不明白什么是 .contains()。 以下是文档中 Firebase 数据库的示例规则: { "rules": { "rooms"
我的问题是我可以给出条件[ 'BookTitleMaster.id' => $xtitid, ] 如下所示 $bbookinfs = $this->BookStockin->BookIssue->fi
我需要能够使用 | 检查模式在他们中。例如,对于像“dtest|test”这样的字符串,像 d*|*t 这样的表达式应该返回 true。 我不是正则表达式英雄,所以我只是尝试了一些事情,例如: Reg
我想创建一个正则表达式来不匹配某些单词... 我的字符:var test = "é123rr;and;ià456;or;456543" 我的正则表达式:test.match(\((?!and)(?!o
我在 XSLT 中有一个名为 variable_name 的变量,如果相关产品具有名称为 A 或 B 或两者均为 A & 的属性,我将尝试将其设置为 1 B.
您好,我想让接待员和经理能够查看工作类型和费率并随后进行更新。但是技术人员只能查看不能更新。该图是否有效? 我读到扩展用例是由发起基本用例的参与者发起的。我应该如何区分技术人员只能启动基本案例而不能启
我是一名优秀的程序员,十分优秀!