Help for a non-developer. Can someone help me with a conditional statement to run the carousel interval script on the homepage only (is_front_page)? And place it script in lib/scripts.php? Or, is there another appropriate way to do this?
$(document).ready(function() {
$(’.carousel’).carousel({
interval: 4000
})
});
ben
September 15, 2013, 3:19pm
2
Just edit _main.js
and place it in the home
init that’s already setup in there
Hi Ben, I’m a total newbie, what do I put in _main.js and do you mean init.php. How?
ben
September 15, 2013, 3:33pm
4
// Modified http://paulirish.com/2009/markup-based-unobtrusive-comprehensive-dom-ready-execution/
// Only fires on body class (working off strictly WordPress body_class)
var ExampleSite = {
// All pages
common: {
init: function() {
// JS here
},
finalize: function() { }
},
// Home page
home: {
init: function() {
// JS here
}
},
// About page
about: {
init: function() {
This file has been truncated. show original
Put $('.carousel').carousel({ interval: 4000 });
on line 15 (where it says JS here under home page) and then run grunt.
great, but i’m not using grunt
Copy the contents of the _main.js file Ben linked above into your /assets/js/main.js file, then make the changes he suggests.
Then go learn why grunt is awesome and start using it.
Thanks Chris! You guys rock. Grunt is on my priority to-learn list.