Random Quote-Feedback and Help

Random Quote-Feedback and Help
0

#1

Guys i almost completed the Random Quote Generator project and need little help

  1. In adding link to buttons for sharing quote or tweeting it.I am not good in API’s and jQuery.
  2. Making First Quote Random and why background color of body is not appearing in first time .
  3. Changing background color of anchor element on hover it is not working properly in CSS.
  4. Suggestions for making page more responsive for mobile devices.
  5. Why JS and jQuery code in script file outside the function is not working.
    Here’s project link-
    https://codepen.io/RaghavJ/pen/rGJwpO

#2

As far as sharing a tweet, you simply use your favorite search engine and search for “how to share a tweet javascript” and read about the various ways of doing so. Part of programming is learning to read through documentation and examples to figure out how to do something new.

You already have code in your newQuote function which generates a random index of your quotes array, so why not create a stand alone function which simply returns a random index of the quotes array and use it inside your new Quote function and also call it when your page loads (inside the .ready function part). Not sure how to answer the 2nd question about the background color not appearing the first time, because I see a background color when the page first loads.

To change the background color of an element for the button hover, you need to use the background-color property. You currently are using the color property, which sets the text color.

Again, try using your favorite search engine for this one, to learn more about best practices for creating responsive designs.

Can you give us more details on what JS and JQuery code is not working?


#3

Sir, thanks for your Help
For 2 query i have tried to change innerHTML of p element by getElementById but it does not work as i mentioned in query 5.
And for query 3 Sir, I am talking about anchor which is used in tweet and share buttons element.
The color attribute you are talking about it is useless now because i used to make text white on hover when i added a class “btn” to button element but it doesn’t work So i removed the class.
and Sir background color of body is not showing in browser for first time