Skip to content

Commit

Permalink
getting random quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajaravi99 committed Oct 12, 2024
2 parents e87fee9 + 527c9e4 commit 8ebf755
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ <h3>Leetcode</h3>
<h2>Hackerrank</h2>
<div class="layer tooltip">
<h3>Hackerrank</h3>
<p>5 star in problem solver, certified as intermidiate problem solver.</p>
<p>5* in problem solver, certified as intermidiate problem solver.</p>
<a href="https://www.hackerrank.com/profile/ravinandanray99">
<span>View Profile</span>
</a>
Expand Down
44 changes: 22 additions & 22 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@ function collectData(){
);
};
const changeQuote=async ()=>{
const link="https://api.api-ninjas.com/v1/quotes?category=happiness";
let data=[
'The greatest glory in living lies not in never falling, but in rising every time we fall',
'The way to get started is to quit talking and begin doing',
'Make it quick make it fast, make it work',
'Programming isn’t about what you know; it’s about what you can figure out',
'Code is read much more often than it is written',
'You might not think that programmers are artists, but programming is an extremely creative profession. It’s logic-based creativity',
'Every great developer you know got there by solving problems they were unqualified to solve until they actually did it',
'Code is like humor. When you have to explain it, it’s bad',
];
let text=document.querySelector(".about-col-1 .link");
let response=await fetch(link,{mode:'no-cors'});
if(!response.ok) {
console.log(response.body);
alert('error while calling api');
}
else{
const json = await response.json();
const rndInt = Math.floor(Math.random() * data.length) + 1;
text.innerHTML=JSON.stringify(data[rndInt].text);
}
const rndInt = Math.floor(Math.random() * data.length);
console.log(rndInt);
text.innerHTML=(data[rndInt]);
};
// attaching blog page while the use clicks on blogs
let doc=document.querySelector(".link #blogs");
Expand All @@ -64,17 +66,15 @@ tag.addEventListener("click", (event) => {
audio.src='./images/mouseClick.mp3';
event.target=audio.play();
},true);
// let flag=false;
// addEventListener('scroll',(event)=>{
// const audio=new Audio();
// audio.src='./images/scrollSound.mp3';
// event.target=audio.play();
// if(!flag){
// alert('Do not panic, the sound is from the webpage scroll event');
// flag=true;
// }
// event.stopPropagation();
// },true);

// let myDiv=document.querySelector('#my-div');
// document.addEventListener('mousemove',(event)=>{
// let x=event.pageX;
// let y=event.pageY;
// myDiv.style.left=x-20+'px';
// myDiv.style.top=y-20+'px';
// });


// creating cursor follower
let myDiv = document.querySelector("#my-div");
Expand Down
10 changes: 6 additions & 4 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -554,17 +554,19 @@ form textarea:hover{
animation: 0.6s ease-out 0s 1 popup;
padding: 40px;
}
#my-div {
width: 2em;
height: 2em;
background-color: #33fff8;

#my-div{
width: 1.5em;
height: 1.5em;
background-color: #ffffff;
position: absolute;
transform: translate(-50%, -50%);
border-radius: 50%;
box-shadow: 0 0 20px rgba(16, 0, 54, 0.2);
transition: 0.1s ease-out;
opacity: 0.5;
}

/* css for small screen */
@media only screen and (max-width: 630px){

Expand Down

0 comments on commit 8ebf755

Please sign in to comment.