Image protection how it works:
- Prevents right-click "Save Image As".
- Prevents dragging an image to the desktop.
- Prevents right-click "Save Background As".
- Prevents right-click "View Background Image"
HTML
<img src="images/charminar_hyderabad.jpg" alt="charminar_hyderabad" class="protect" /> <img src="images/statue_of_liberty.jpg" alt="statue_of_liberty" class="protect" />
jQuery Plugin JavaScript
jQuery.fn.protectImage = function(settings) {
settings = jQuery.extend({
image: 'blank.gif',
zIndex: 10
}, settings);
return this.each(function() {
var position = $(this).position();
var height = $(this).height();
var width = $(this).width();
$('
').attr({
width: width,
height: height,
src: settings.image
}).css({
//border: '1px solid #f00',
top: position.top,
left: position.left,
position: 'absolute',
zIndex: settings.zIndex
}).appendTo('body')
});
};
jQuery Usage
$(window).bind('load', function() {
$('img.protect').protectImage();
});
jquery-1.2.6.js
Click Here to DOWNLOAD
jquery.dimensions.js
Click Here to DOWNLOAD
jquery.dwImageProtector.js
Click Here to DOWNLOAD
Example
Click to DEMO











0 comments:
Post a Comment