21310 Posts in 5739 Topics by 2604 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1903 Views |
-
Coda-slider

23 September 2009 at 10:51am
What would I have to do to include a Javascript slider for featured work in SilverStripe? I have already looked through the forums and have found nothing. Sorry to ask such a question, I've just all ready tried a lot of things.
-
Re: Coda-slider

23 September 2009 at 2:55pm Last edited: 23 September 2009 2:59pm
I have done this with the jQuery Slider without much trouble.
Read the docs here: http://docs.jquery.com/UI/Slider
Drop this in your controller/form/whatever:
Requirements::css(THIRDPARTY_DIR.'/jquery/themes/default/ui.all.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery-packed.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/ui/ui.core.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/ui/ui.slider.js');
Requirements::javascript('/mysite/javascript/myslider.js');Add an appriopriately ID'd <div id="myslider"></div> in your template, create and init the object in the myslider.js file:
jQuery(document).ready(
function() {
// Prototype doesn't like $
jQuery.noConflict();// Prep the slider
jQuery('#myslider').slider({
'stepping': 1,
'min': 1,
'max': 100
});
}
);You should be off and running like a trademarked green tractor manufacturer's mascot.
| 1903 Views | ||
|
Page:
1
|
Go to Top |


