/*
Object.Carousel.prototype.test = function(){
console.log('worked');
};
*/
/*
var carouselsInWindow = window.document.querySelectorAll('.carousel');
for(var i=0; i < carouselsInWindow.length; i++ ){
carouselsInWindow[i].Carousel.prototype.test = function(){
console.log('test worked');
};
}
*/
// WHY IS 'THIS' the window and not the instantianted instance?
// Because it's not this of an object... but this of an
var OCUCarousel = function(index,element) {
this.childCarousel = index;
this.element = element;
// I need to setup an event on the button it finds within the carousel ... so when a button is pressed it will return which index carousel it is
// pub methods
this.init = function() {
console.log('There is an OCUCarousel on page. ' + this.childCarousel);
};
// ...
this.init(); // <------------ added this
}
OCUCarousel.prototype.addEventToChildButton = function(childlist){
console.log(childlist);
}
OCUCarousel.prototype.report = function() {
console.log(this.childCarousel);
}
OCUCarousel.prototype.report2 = function() {
console.log(this.childCarousel);
}
OCUCarousel.prototype.buttonReport = function(input) {
console.log(input);
}
OCUCarousel.prototype.elementReport = function(){
var e = this.element.querySelectorAll('button');
for(var i = 0; i < e.length; i++ ){
var thisButton = e[i].innerHTML;
e[i].onclick = function(){OCUCarousel.prototype.buttonReport(thisButton);};
}
}
// Set our own name space for OCU:
var OCU = OCU || {};
window.OCU = OCU;
//pass namespace into an IIFE. Within the IIFE refer to namespace as "ns_obj"
(function(ns_obj){
ns_obj.carousels = {};
// first, did the Carousel from bootstrap actually load?
if (typeof window.Carousel != "undefined") {
var carouselsInWindow = window.document.querySelectorAll('.carousel');
for(var i=0; i < carouselsInWindow.length; i++ ){
// assign a new OCUCarousel to each bootstrap carousel
var _neoCarousel = new...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.