Skip to content
Snippets Groups Projects
Commit 87c8cb7a authored by Andrew Berezovsky's avatar Andrew Berezovsky
Browse files

Reworked transparent.gif logic

parent a766178d
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
var self = this; var self = this;
$images.each(function(index, Element) { $images.each(function(index, Element) {
if (this.naturalWidth == 0 || this.naturalHeight == 0) { if (this.naturalWidth == 0 || this.naturalHeight == 0) {
this.onload = function() { self.process.call(this); }; $(this).bind('load', function() {
self.process.call(this);
});
} }
else { else {
self.process.call(this); self.process.call(this);
...@@ -38,14 +40,16 @@ ...@@ -38,14 +40,16 @@
} }
$(this).addClass('copyprevention-processed'); $(this).addClass('copyprevention-processed');
$(this).bind('mouseenter', function(event) { $(this).bind('mouseover', function(event) {
var pos = $(this).position();
//var pos = $(this).offset(); //var pos = $(this).offset();
var html = '<img src="' + Drupal.settings.copyprevention.transparentgif + '" class="copyprevention-transparent-gif" width="' + this.clientWidth + '" height="' + this.clientHeight + '" style="position: absolute; left: ' + pos.left + 'px; top: ' + pos.top + 'px">'; var pos = $(this).position();
var $overlay = $(html).insertAfter(this).bind('mouseleave', function() { var html = '<div class="copyprevention-transparent-gif" style="position: absolute; left: ' + pos.left + 'px; top: ' + pos.top + 'px">'
//var $overlay = $(html).appendTo('body').bind('mouseleave', function() { + '<img src="' + Drupal.settings.copyprevention.transparentgif + '" width="' + this.clientWidth + '" height="' + this.clientHeight + '"></div>';
$overlay.remove(); //var $overlay = $(html).appendTo('body')
}); var $overlay = $(html).insertAfter(this)
.bind('mouseout', function(e) {
$overlay.remove();
})
}); });
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment