Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit e55102ef29c4bf9d2075600054f213b13a082a1c 1 parent 6c54194
@sminnee sminnee authored
Showing with 12 additions and 13 deletions.
  1. +0 −1  forms/ImageFormAction.php
  2. +12 −12 javascript/ImageFormAction.js
View
1  forms/ImageFormAction.php
@@ -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 = '';
View
24 javascript/ImageFormAction.js
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.