npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dynamicloaderjs

v1.0.0

Published

DynamicLoaderJS is a lightweight JavaScript library that enables dynamic loading of content into web pages without page refresh. It provides a simple and flexible way to update specific sections of a website, such as the main content area, header, or foot

Downloads

3

Readme

DynamicLoaderJS

DynamicLoaderJS is a lightweight JavaScript library that enables dynamic loading of content into web pages without page refresh. It provides a simple and flexible way to update specific sections of a website, such as the main content area, header, or footer, without reloading the entire page.

GitHub license GitHub issues GitHub stars GitHub forks

Table of Contents

Features

  • Dynamic loading of content into HTML elements
  • Smooth animation effects during content transition
  • Support for loading specific sections like header and footer
  • URL update without page refresh
  • Custom events for content load completion
  • Ability to load CSS and JavaScript files dynamically
  • Built-in loader element for visual feedback during content loading

Autoload

Run the autoload function after every function happened, because js can't target the new rendered html. So, that nesting of elements can happen. (Optional)

DynamicLoader.autoLoad();

Installation

You can include DynamicLoaderJS in your project by downloading the DynamicLoader.js file and including it in your HTML file:

<script src="path/to/DynamicLoader.js"></script>

Alternatively, you can use a CDN by including the following script tag in your HTML file:

<script src="https://cdn.jsdelivr.net/gh/SH20RAJ/DynamicLoaderJS@main/DynamicLoader.js"></script>

Usage

  1. Add the data-load attribute to the HTML element where you want to load the content. Set the value of data-load to the URL of the content you want to load.
<div data-load="page1.html" data-target="#content"></div>
  • The data-load attribute specifies the URL of the content to be loaded.
  • The data-target attribute specifies the selector of the target element where the content will be loaded.
  1. Optionally, you can add the data-loader attribute to show a loader during content loading. Set data-loader to "true" to enable the loader.
  2. Use data-title to change the document title after click.
<div data-load="page1.html" data-target="#content" data-loader="true" data-title="Page1"></div>
  1. You can also load specific sections like header and footer separately. Add the data-load attribute to the respective HTML element and specify the target selector using the data-target attribute.
<header data-load="header.html" ></header>
<footer data-load="footer.html" ></footer>
  1. To load CSS or JavaScript files dynamically, use the loadFile function with the URL of the file and the file type as parameters.
DynamicLoader.loadFile('https://cdn.example.com/styles.css', 'css');
DynamicLoader.loadFile('https://cdn.example.com/script.js', 'js');
  1. You can also load content into an element using JavaScript by calling DynamicLoader.load() and passing the selector, URL, and optional loader element.
DynamicLoader.load('#op', 'page3.html');

This will load the content from page3.html into the element with the selector #op.

Examples

For detailed usage examples, please refer to the Examples directory in this repository.

Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please create an issue or submit a pull request.

License

This project is licensed under the MIT License.

Credits

Created with ❤️ by SH20RAJ