Skip to content

Commit 4aa2832

Browse files
authored
FAQ Dropdown Widget (#1602)
- Implemented a responsive FAQ dropdown widget for ServiceNow Portal. - Included interactive functionality for question and answer visibility. - Styled the widget with CSS for an enhanced user experience. - Added sample questions and answers in the client script.
1 parent c5d5ce4 commit 4aa2832

File tree

4 files changed

+114
-0
lines changed

4 files changed

+114
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# FAQ Dropdown Widget
2+
3+
This is a simple FAQ dropdown widget for ServiceNow Portal that allows users to click on questions to reveal their answers. The widget is designed to enhance user experience by providing easy access to frequently asked questions.
4+
5+
## Features
6+
7+
- Interactive dropdown for questions and answers.
8+
- Animated arrow indicators that change based on the answer's visibility.
9+
- Simple and clean design that fits seamlessly into the ServiceNow Portal.
10+
11+
## Usage
12+
13+
Add the Widget to a Page
14+
Once the widget is created, add it to a desired page in your ServiceNow portal.
15+
Interact with the FAQ
16+
Load the portal to view the widget and click on the questions to reveal the answers.
17+
18+
19+
## Customization
20+
21+
22+
You can modify the faqs array in the Client Script to add your own questions and answers.
23+
Customize the CSS styles to match your portal's design.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<div class="faq-widget">
2+
<h2>Frequently Asked Questions</h2>
3+
<div ng-repeat="faq in faqs" class="faq-item">
4+
<div class="faq-question" ng-click="faq.show = !faq.show">
5+
<h3>{{ faq.question }}</h3>
6+
<span ng-class="{'arrow-up': faq.show, 'arrow-down': !faq.show}"></span>
7+
</div>
8+
<div class="faq-answer" ng-show="faq.show">
9+
<p>{{ faq.answer }}</p>
10+
</div>
11+
</div>
12+
</div>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
api.controller = function($scope) {
2+
// Sample FAQs
3+
$scope.faqs = [
4+
{
5+
question: 'What is ServiceNow?',
6+
answer: 'ServiceNow is a cloud-based platform that helps companies manage their digital workflows.'
7+
},
8+
{
9+
question: 'How do I create a ticket?',
10+
answer: 'You can create a ticket by navigating to the Service Desk and filling out the form.'
11+
},
12+
{
13+
question: 'What are the system requirements?',
14+
answer: 'ServiceNow is a cloud-based solution, so it only requires a modern web browser to access.'
15+
},
16+
{
17+
question: 'How do I reset my password?',
18+
answer: 'You can reset your password by clicking on the "Forgot Password" link on the login page.'
19+
}
20+
];
21+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.faq-widget {
2+
max-width: 600px;
3+
margin: auto;
4+
font-family: Arial, sans-serif;
5+
}
6+
7+
h2 {
8+
text-align: center;
9+
color: #333;
10+
}
11+
12+
.faq-item {
13+
border: 1px solid #ccc;
14+
border-radius: 5px;
15+
margin-bottom: 10px;
16+
overflow: hidden;
17+
transition: box-shadow 0.2s ease;
18+
}
19+
20+
.faq-item:hover {
21+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
22+
}
23+
24+
.faq-question {
25+
background-color: #007bff; /* Header background color */
26+
color: white;
27+
padding: 15px;
28+
cursor: pointer;
29+
display: flex;
30+
justify-content: space-between; /* Align question and arrow */
31+
align-items: center; /* Center vertically */
32+
}
33+
34+
.faq-question h3 {
35+
margin: 0; /* Remove default margin */
36+
}
37+
38+
.faq-answer {
39+
padding: 15px;
40+
background-color: #f9f9f9; /* Answer background color */
41+
color: #333;
42+
}
43+
44+
.arrow-up {
45+
border: solid white;
46+
border-width: 0 4px 4px 0;
47+
display: inline-block;
48+
padding: 3px;
49+
transform: rotate(-135deg);
50+
}
51+
52+
.arrow-down {
53+
border: solid white;
54+
border-width: 0 4px 4px 0;
55+
display: inline-block;
56+
padding: 3px;
57+
transform: rotate(45deg);
58+
}

0 commit comments

Comments
 (0)