I am trying to repeat a callback function on a click method within my javascript. All I want to do is reference the code from function() on. On my #previous and #next click methods, I don’t want to call slideswitch. I want to run the code from line 4 on my code down. I realize I need to take out the function call for slideswitch, I just wanted to reference it for the discussion.
$holder.quicksand($filteredData, {
duration: 800,
easing: 'easeInOutQuad'
line 4 }, function() {
$(".portfolioLink").click(function(){
$(".inner-content.portfolio").show();
clearInterval($('#slides').data('interval'));
$("ul.pagination li").removeClass("current");
var number = $(this).attr("data-id");
var slideID = $(this).parent().attr("id");
$("#previous").click(function() {
slideID--;
clearInterval($('#slides').data('interval'));
$("ul.pagination li").removeClass("current");
slideswitch(slideID);
});
$("#next").click(function() {
slideID++;
clearInterval($('#slides').data('interval'));
$("ul.pagination li").removeClass("current");
slideswitch(slideID);
});
How would I achieve this?
And your function definition (there are some problems with your code so this might not be structured correctly:
Also, you shouldn’t be binding events in a function you plan on calling multiple times.