- The plugin is written in a "global" syntax, meaning that it depends on
this
references towindow
. Also it creates a global variableMagic360
usingvar Magic 360 = X
. That means, that it doesn't work in CommonJS (e.g. Webpack) or AMD (e.g. RequireJS) environments. In case of Webpack it's necessary to use the script loader that runs it in the global context. - The plugin doesn't allow a way to initialize new 360 viewers by JS. The only way it can work is by parsing elements with a class
Magic360
on DOM ready. This means that you can't e.g. provide settings by JS for a single instance. You need to provide all options globally for all instances. Also, this means that if you're using AJAX you can't use this plugin, as the plugin doesn't re-parse the DOM after a XMLHttpRequest was done. Also, this means that you need to pass an instance "id" on every method call, which brings an incredible overhead (you would also create an id attribute on every
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://htmldom.dev/scroll-to-an-element-smoothly/ | |
const scrollToTarget = function (target, duration) { | |
const top = target.getBoundingClientRect().top; | |
const startPos = window.pageYOffset; | |
const diff = top; | |
let startTime = null; | |
let requestId; | |
const loop = function (currentTime) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install e.g. http-server globally (https://www.npmjs.com/package/http-server) | |
2. Run http-server in this folder | |
3. Open http://localhost:8080/ in Chrome (there are polyfills available to make it work in other browsers too) |
- When using GitHub pages to host a website this means that the website will be published over and over again for each fork (after a push). This is a problem for search engine optimization as it will be duplicate content. This is also a user experience problem, as users don't know which website is the original one.
- With GitHub pages it not possible to use htaccess. This is a problem for the following situations:
- Calling a directory with "/" and with "/index.html" is possible (duplicate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/*!*************************************************** | |
#* The MIT License (MIT) | |
#* | |
#* Copyright (c) 2014-2017, Julian Motz | |
#* | |
#* Permission is hereby granted, free of charge, to any person obtaining a copy | |
#* of this software and associated documentation files (the "Software"), to deal | |
#* in the Software without restriction, including without limitation the rights | |
#* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
#* copies of the Software, and to permit persons to whom the Software is |