PhotoDune

start and Stop button not working

63 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 10 000 and 50 000 dollars
bigtreat says

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

3 posts
  • Bought between 1 and 9 items
  • Europe
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 1 000 and 5 000 dollars
maniacpc says
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.

63 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 10 000 and 50 000 dollars
bigtreat says

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


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.
63 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 10 000 and 50 000 dollars
bigtreat says

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
});

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.
by
by
by
by
by