Skip to content

Commit

Permalink
fix: the demo is not working in the localhost
Browse files Browse the repository at this point in the history
- Fix the demo is not working in the localhost
- Add .editorconfig
- Change output path from /dist to /demo/dist
  • Loading branch information
kimyvgy committed Oct 16, 2020
1 parent b7a4bcf commit 41cf4b3
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 45 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
root = true
indent_style = space
indent_size = 2
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ npm-debug.log
yarn-error.log
yarn.lock
/dist
/demo/dist
90 changes: 46 additions & 44 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,59 +1,61 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Simple Scrollspy</title>
<link rel="stylesheet" href="demo.css">
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Simple Scrollspy</title>
<link rel="stylesheet" href="demo.css">
</head>

<body>

<nav class="navbar">
<nav class="navbar">
<div class="container">
<div class="navbar-brand">
<h1>
<a href="">Simple Scrollspy</a>
</h1>
</div>

<div class="menu" id="main-menu">
<a class="menu-item active" href="#hero">Hero</a>
<a class="menu-item" href="#section-1">Section 1</a>
<a class="menu-item" href="#section-2">Section 2</a>
<a class="menu-item" href="#section-3">Section 3</a>
<a class="menu-item" href="#section-4">Section 4</a>
</div>
<div class="navbar-brand">
<h1>
<a href="">Simple Scrollspy</a>
</h1>
</div>

<div class="menu" id="main-menu">
<a class="menu-item active" href="#hero">Hero</a>
<a class="menu-item" href="#section-1">Section 1</a>
<a class="menu-item" href="#section-2">Section 2</a>
<a class="menu-item" href="#section-3">Section 3</a>
<a class="menu-item" href="#section-4">Section 4</a>
</div>
</div>
</nav>
</nav>

<section class="section scrollspy" id="hero">Hero</section>
<section class="section scrollspy" id="section-1">Section 1</section>
<section class="section scrollspy" id="section-2">Section 2</section>
<section class="section scrollspy" id="section-3">Section 3</section>
<section class="section scrollspy" id="section-4">Section 4</section>
<section class="section scrollspy" id="hero">Hero</section>
<section class="section scrollspy" id="section-1">Section 1</section>
<section class="section scrollspy" id="section-2">Section 2</section>
<section class="section scrollspy" id="section-3">Section 3</section>
<section class="section scrollspy" id="section-4">Section 4</section>

<footer class="footer">
<footer class="footer">
<div class="container">
<p>
<a href="https://github.com/huukimit/simple-scrollspy" title="Fork me on Github">
Simple Scrollspy - Github
</a>
</p>
<p>
<a href="https://github.com/huukimit/simple-scrollspy" title="Fork me on Github">
Simple Scrollspy - Github
</a>
</p>
</div>
</footer>

<script src="../dist/simple-scrollspy.min.js"></script>
<script>
window.onload = function () {
scrollSpy('#main-menu', {
sectionClass: '.scrollspy',
menuActiveTarget: '.menu-item',
offset: 100
})
}
</script>
</footer>

<script src="dist/simple-scrollspy.min.js"></script>
<script>
window.onload = function () {
scrollSpy('#main-menu', {
sectionClass: '.scrollspy',
menuActiveTarget: '.menu-item',
offset: 100
})
}
</script>
</body>

</html>
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
entry: resolve(__dirname, 'src/index.js'),

output: {
path: resolve(__dirname, 'dist'),
path: resolve(__dirname, 'demo/dist'),
filename: 'simple-scrollspy.min.js',
library: 'scrollSpy',
libraryTarget: 'umd'
Expand Down

0 comments on commit 41cf4b3

Please sign in to comment.