Permalink
Browse files

MINOR Using jquery.live instead of livequery on ImageFormAction.js (f…

…rom r100886)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111534 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 6c54194 commit e55102ef29c4bf9d2075600054f213b13a082a1c @sminnee sminnee committed Oct 4, 2010
Showing with 12 additions and 13 deletions.
  1. +0 −1 forms/ImageFormAction.php
  2. +12 −12 javascript/ImageFormAction.js
@@ -23,7 +23,6 @@ function __construct($action, $title = "", $image = "", $hoverImage = null, $cla
}
function Field() {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
- Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/ImageFormAction.js');
$classClause = '';
@@ -1,18 +1,18 @@
-(function($) {
+(function($) {
$(document).ready(function() {
- $("input.rollover").livequery(function(){
- var srcParts = jQuery(this).attr('src').match( /(.*)\.([a-zA-Z]+)$/ );
- var fileName = srcParts[1];
- var extension = srcParts[2];
- this.overSrc = fileName + '_over.' + extension;
- this.outSrc = jQuery(this).attr('src');
- });
- $("input.rollover").livequery('mouseover', function(){
- jQuery(this).attr('src', this.overSrc);
+ $("input.rollover").live('mouseover', function(){
+ if(!this.overSrc) {
+ var srcParts = $(this).attr('src').match( /(.*)\.([a-zA-Z]+)$/ );
+ var fileName = srcParts[1];
+ var extension = srcParts[2];
+ this.overSrc = fileName + '_over.' + extension;
+ this.outSrc = $(this).attr('src');
+ }
+ $(this).attr('src', this.overSrc);
});
- $("input.rollover").livequery('mouseout', function(){
- jQuery(this).attr('src', this.outSrc);
+ $("input.rollover").live('mouseout', function(){
+ $(this).attr('src', this.outSrc);
});
});
})(jQuery);

0 comments on commit e55102e

Please sign in to comment.