Dynamic Content Loading Plugin With jQuery ViaJS - Download Dynamic Content Loading Plugin With jQuery - ViaJS

Download Dynamic Content Loading Plugin With jQuery – ViaJS

Posted on

This time I will share jQuery Plugin and tutorial about Dynamic Content Loading Plugin With jQuery – ViaJS, hope it will help you in programming stack.

Dynamic Content Loading Plugin With jQuery ViaJS - Download Dynamic Content Loading Plugin With jQuery - ViaJS
File Size: 7.74 KB
Views Total: 1438
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

ViaJS is a lightweight, jQuery dependent JavaScript library which allows to dynamically load external html content into your webpage without reloading the current page. Based on XMLHttpRequest web API.

How to use it:

1. Load jQuery library and the jQuery ViaJS’ JavaScript in your html document.

1 <script src="//code.jquery.com/jquery.min.js"></script>
2 <script src="lib/app.js"></script>

2. Add the via-views attribute to DIV containers where you want to fetch and place external content.

1 <div class="container" id="title" via-views>Title</div>
2 <div class="container" id="content" via-views>Content</div>

3. Specify the URLs you want to load into the DIV containers.

01 var views = {
02     home: [{
03       selector: "#title",
04       templateUrl: 'title.html'
05     }, {
06       selector: "#content",
07       templateUrl: 'content.html'
08     },
09     ],
10     defaultView: {
11       view: 'home'
12     }
13 };

4. Create an anchor link that will fetch and insert the html files as displayed above into to the ‘title’ and ‘content’ containers.

1 <a via-link via-href="home">Home</a>

5. Initialize the ViaJS and done.

1 new Via(views);

This awesome jQuery plugin is developed by abdi0987. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net