I have this javascript file开发者_运维技巧: http://pastebin.com/m2keHsTM
A big part of it is a toggle switch that works by sliding your finger or mouse on it. As you see at the end of the document
var togglebox = "<div class='toggle_box'></div>";
$('input[type=checkbox]').css('display','none');
$('fieldset[data-input-type=checkbox]').append(togglebox);
var mouseDown = false;
var beginTouchDown = 0;
create_elements();
set_listeners();
replaces the checkboxes on the page by div's that are "slideable" This works great, only when I load another page trough ajax, other new checkboxes do not get replaced. Is there a way to reset those functions and make them check again after an ajax call?
Thanks a lot for your help :)
You can:
- Call
set_listeners
also after theload
function call: http://api.jquery.com/load - Change
set_listeners
to bind to events withlive
instead ofbind
ormouse...
event binders: http://api.jquery.com/live
I just added the original functions to hijacklinks()
to initiate them each time the page changes :)
精彩评论