Change javascript function -
i have function in theme.js file
$('.open_copy').click(function(){ var = $(this); var copy = that.prev(); that.parents('.asset').find('.cover').click(); copy.css('opacity', 0).show(); if (copy.children('.copy_content').data('jsp')) { copy.children('.copy_content').data('jsp').destroy(); } var height = copy.children('.copy_content').css({height: ''}).height(); if (height < that.parents('.asset').height() - 37) { var top = (that.parents('.asset').height() - height)/2; top = top < 37 ? 37 : top; copy.children('.copy_content').css({'margin-top': top}); } else { copy.children('.copy_content').css({'margin-top': '', height: that.parents('.asset').height() - 37}).jscrollpane(); } if (!that.parents('.asset').find('.close_copy').length) { that.prev().append('<a href="#" class="close_copy">close</a>'); } copy.animate({ 'opacity' : 1 }, 500); that.fadeout(500); return false; });
i need change opacity value 0.9 don't have access theme.js file. there way can change/alter function adding function in html page?
copy.animate({ 'opacity' : 1 }, 500);
yes. can remove click handler code sets up, , add own identical code except 1
=> 0.9
change.
to remove code's click handler (and others), use off
:
$('.open_copy').off('click');
...and of course add own, new click
handler.
so in total, then, you'd want code (after script
tag including theme.js
, code runs after code):
$('.open_copy').off('click').click(function(){ // <== changed var = $(this); var copy = that.prev(); that.parents('.asset').find('.cover').click(); copy.css('opacity', 0).show(); if (copy.children('.copy_content').data('jsp')) { copy.children('.copy_content').data('jsp').destroy(); } var height = copy.children('.copy_content').css({height: ''}).height(); if (height < that.parents('.asset').height() - 37) { var top = (that.parents('.asset').height() - height)/2; top = top < 37 ? 37 : top; copy.children('.copy_content').css({'margin-top': top}); } else { copy.children('.copy_content').css({'margin-top': '', height: that.parents('.asset').height() - 37}).jscrollpane(); } if (!that.parents('.asset').find('.close_copy').length) { that.prev().append('<a href="#" class="close_copy">close</a>'); } copy.animate({ 'opacity' : 0.9 }, 500); // <== changed that.fadeout(500); return false; });
you'll want check side effects (for instance, if there's other code sets click
handlers on elements, since code above remove them, too).
Comments
Post a Comment