Hi i am trying to add the start and stop button on http://slidesjs.com/ slider but it is not working
function stop() {
// clear interval from stored id
clearInterval(elem.data('interval'));
}
$('a#stop').click(function(){
if($(this).text() 'stop')
{
stop();
$(this).text('start').css("background-image", "url(images/play.jpg)");
});
}
else if($(this).text() 'start'){
pause();
$(this).text('stop').css("background-image", "url(images/pause.jpg)");
}
return false;
Please somebody help me
this.stop() = function() {
clearInterval(elem.data('interval'));
}
Now you can call the function as you wish:
var slider1 = $('#slides').slides({
someOptions
});
$('a#stop').click(function(){
slider1.stop();
});
2) Its more difficult solution but maybe its better. You can add two parameters to the options of the plugin (for example stopButton etc.) Now add this function to the plugin:
$(option.stopButton).click(function() {
stop();
});
But I havent read the license of the slider. Maybe you are not allowed to change the source code of the slider. Its up to you to find it out. I hope it helps a bit.
thanks a lot maniacpc can you please tell me
apache license allowed me to modify the file or not or is there any to do from externally
here is the license http://www.apache.org/licenses/LICENSE-2.0
Please reply soon
maniacpc said
Hi, the problem is that the function stop() of the slider plugin is defined as private, which means you can call it only from this plugin. Off the top of my head there are two solutions: 1) Make the function public (Do the same for any function you want to be public)this.stop() = function() { clearInterval(elem.data('interval')); }Now you can call the function as you wish:var slider1 = $('#slides').slides({ someOptions }); $('a#stop').click(function(){ slider1.stop(); });2) Its more difficult solution but maybe its better. You can add two parameters to the options of the plugin (for example stopButton etc.) Now add this function to the plugin:$(option.stopButton).click(function() { stop(); });But I havent read the license of the slider. Maybe you are not allowed to change the source code of the slider. Its up to you to find it out. I hope it helps a bit.
Hi according to the license i can not edit the plugin so i tried the following codes but only stop button is working
$(‘a#stop’).click(function(){ clearInterval( $(”#slides”).data(‘interval’));
});
$('a#play').click(function(){
//what i do here
});
maniacpc said
Hi, the problem is that the function stop() of the slider plugin is defined as private, which means you can call it only from this plugin. Off the top of my head there are two solutions: 1) Make the function public (Do the same for any function you want to be public)this.stop() = function() { clearInterval(elem.data('interval')); }Now you can call the function as you wish:var slider1 = $('#slides').slides({ someOptions }); $('a#stop').click(function(){ slider1.stop(); });2) Its more difficult solution but maybe its better. You can add two parameters to the options of the plugin (for example stopButton etc.) Now add this function to the plugin:$(option.stopButton).click(function() { stop(); });But I havent read the license of the slider. Maybe you are not allowed to change the source code of the slider. Its up to you to find it out. I hope it helps a bit.
