jPages icon indicating copy to clipboard operation
jPages copied to clipboard

Multiple jPages controls and 'destroy' method

Open vpiyanov opened this issue 12 years ago • 4 comments

The 'destroy' is destroying incorrect jPages control in case multiple jPages controls exist on the page.

To reproduce see: http://jsfiddle.net/HNKEz/ Change value in the first combobox and both jPages controls get broken.

vpiyanov avatar Jun 18 '12 14:06 vpiyanov

Anybody find a solution to this?

michellcampos avatar Aug 27 '13 12:08 michellcampos

...not sure if there're still people with this problem actually the plugin didn't seem to be built to cater with multiple instances, the only workaround I could think of and actually work, is to copy the js file and probably name it jPages2.js, and replace all instances of "jPages" to "jPagestwo" inside the new js file, go on the number line if you have more than 2, and call functions using .jPages(), jPagestwo() and so on, please kindly let me know if there're any better ways... but this works for me - the bottom line

dracoheimerich avatar Feb 09 '14 15:02 dracoheimerich

2 years ago I have submitted pull request with fix: https://github.com/luis-almeida/jPages/pull/12

vpiyanov avatar Feb 10 '14 05:02 vpiyanov

I wrote my own Destroy function based on what was in the plugin.

// holder == The pagination holder // container == The container for the items to pagination // item == The item that is being paginated through

function destroyJPages(holder, container, item) {

  $(container).unbind("keydown.jPages");
  $(container).unbind("mousewheel.jPages DOMMouseScroll.jPages");
  $(container).css("min-height", "");
  $(container+" "+item).css("display","initial");
  $(holder).removeClass("animated jp-hidden jp-invisible ");
  $(holder).removeClass("jp-hidden").fadeTo(0, 1);
  $(holder).unbind("click.jPages").empty();

}

katieschrader avatar Apr 10 '15 17:04 katieschrader