Last active
December 18, 2015 03:29
-
-
Save thetrickster/5718742 to your computer and use it in GitHub Desktop.
Business Catalyst Multiple Random Web App Items - Add this code to your page where you want the random items to appear.
This file contains hidden or 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 element where your web app items will be appended to. | |
By default the script looks for an id of "random-web-app-items" | |
IMPORTANT: jQuery must be loaded on the page either in the HEAD of the doc or before you call the SCRIPTS below. | |
--> | |
<div id="random-web-app-items"></div> | |
<!-- Download this script to your site and replace the SRC with the path to your site's javascript file --> | |
<script src="//gist.github.com/thetrickster/5718857/raw/f0d736a4f80248c9c1a4184dcc43e223ac1e1d03/random-web-app-items.js"></script> | |
<script> | |
// Setup a javascript array to hold our web app item data | |
var webAppItems = []; | |
/* | |
This webapps module outputs all the web app items (up to 100) and uses a custom template which can be | |
found at: https://gist.github.com/thetrickster/5718819 | |
Replace the attributes below with your webapp ID and the path to your site's custom module template. | |
*/ | |
{module_webapps,13853,a,,,,,,100 template="random-webapp-layout.tpl"} | |
$(document).ready(function() { | |
// Function takes two arguments: target and num | |
// target: the element you are going to add the web app items to, it's usually an empty div.. | |
// // default value: $("#random-web-app-items") | |
// num: the number of random web app items to insert into the target | |
// // default: 2 | |
randomWebAppItems(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Business Catalyst Multiple Random Web App Items
See the javascript/code needed to run randomWebAppItems(): https://gist.github.com/thetrickster/5718857
See the custom module template the module above renders: https://gist.github.com/thetrickster/5718819
HTML and Javascript for the destination page for your random web app items.