frayerjj-frontend 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/init.js +17 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frayerjj-frontend",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "My base frontend for various projects",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/init.js CHANGED
@@ -110,7 +110,7 @@ export const init = () => {
110
110
  msg.verbose('Enabling Filter Select');
111
111
  select.addEventListener('change', ev => {
112
112
  msg.verbose('Filter Select Triggered');
113
- document.querySelectorAll('.filter-items').forEach(el => {
113
+ document.querySelectorAll('.filter-item').forEach(el => {
114
114
  el.style.display = '';
115
115
  filterSelects.forEach(filter => {
116
116
  if (filter.value) {
@@ -125,20 +125,22 @@ export const init = () => {
125
125
 
126
126
  // Scroll to top button
127
127
  let toTop = document.getElementById('toTopBtn');
128
- toTop.style.visibility = "hidden";
129
- toTop.addEventListener('click', () => {
130
- msg.verbose('Scrolling to Top');
131
- scrollTo(0, 0);
132
- });
133
- window.addEventListener('scroll', () => {
134
- if (scrollY > 1500) {
135
- msg.verbose('Scrolling to Top Button Visible');
136
- toTop.style.visibility = "visible";
137
- } else {
138
- msg.verbose('Scrolling to Top Button Hidden');
139
- toTop.style.visibility = "hidden";
140
- }
141
- });
128
+ if (toTop) {
129
+ toTop.style.visibility = "hidden";
130
+ toTop.addEventListener('click', () => {
131
+ msg.verbose('Scrolling to Top');
132
+ scrollTo(0, 0);
133
+ });
134
+ window.addEventListener('scroll', () => {
135
+ if (scrollY > 1500) {
136
+ msg.verbose('Scrolling to Top Button Visible');
137
+ toTop.style.visibility = "visible";
138
+ } else {
139
+ msg.verbose('Scrolling to Top Button Hidden');
140
+ toTop.style.visibility = "hidden";
141
+ }
142
+ });
143
+ }
142
144
 
143
145
  });
144
146