Skip to content

Commit

Permalink
Merge pull request #1504 from LoiueFragosoUwUr/main
Browse files Browse the repository at this point in the history
Scroll in gita storyline is visible and resets its position when changing dialog in bubbles
  • Loading branch information
akshitagupta15june committed Apr 8, 2024
2 parents 4e8c57c + 9009fbc commit c587e4a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
14 changes: 11 additions & 3 deletions Gita-Storyline/storyline.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ background-size: cover;
.bubble1 {
--r: 25px; /* the radius */
--t: 40px; /* the size of the tail */

max-width: 300px;
max-height: 200px;
padding: calc(2*var(--r)/3);
Expand Down Expand Up @@ -248,10 +248,17 @@ background-size: cover;
margin-top: -11rem;
}
.bubble2 {



scrollbar-color: blue orange;
scrollbar-width: thin;
scroll-margin-top: 0;

margin-bottom: 8rem;
overflow-wrap: break-word;
overflow-y: auto;
overflow-y: scroll;


--r: 25px; /* the radius */
--t: 40px; /* the size of the tail */

Expand All @@ -276,6 +283,7 @@ background-size: cover;
.bubble2::-webkit-scrollbar {
display: none;
}

.left {
--_d: 0%;
border-left: var(--t) solid #0000;
Expand Down
14 changes: 12 additions & 2 deletions Gita-Storyline/storyline.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const arjunaConversation = document.querySelector(".arjuna-conversation"); // making this two classes arjuna and krishna
const krishnaConversation = document.querySelector(".krishna-conversation");

var bubble2 = document.querySelector('.bubble2');
const question = [
{
Arjuna: "What should one do when parents don't understand him/her? ",
Expand Down Expand Up @@ -61,8 +61,13 @@ function showQuestion(){
let currentQuestion = question[currentQuestionIndex];
arjunaConversation.innerText = currentQuestion.Arjuna;
krishnaConversation.innerText = currentQuestion.Krishna;

}
function initialize_scroll(){

bubble2.scrollTop=0;

}

document.addEventListener('keydown',(e)=>{
if(e.keyCode == 37) {
currentQuestionIndex = (currentQuestionIndex - 1 + question.length) % question.length;
Expand All @@ -77,14 +82,19 @@ document.addEventListener('keydown',(e)=>{
let left=document.getElementById("left")
let right=document.getElementById('right')


left.addEventListener("click", () => {

currentQuestionIndex = (currentQuestionIndex - 1 + question.length) % question.length;
showQuestion();
initialize_scroll();

});

right.addEventListener("click", () => {
currentQuestionIndex = (currentQuestionIndex + 1) % question.length;
showQuestion();
initialize_scroll();
});

showQuestion();
Expand Down

0 comments on commit c587e4a

Please sign in to comment.