Home › Forums › JavaScript › How to disable the ´slash´ SVG image transformation effect in Script.JS Code… › Re: How to disable the ´slash´ SVG image transformation effect in Script.JS Code…
/* Swap featured image by vector objects os slashed shape */
$(document).ready(function() {
// Swap featured images with vector objects
$(“.img-holder”).each(function () {
//$(this).removeClass(‘ro’);
var img = $(this).find(“img”);
var img_w = img.attr(“width”);
var img_h = img.attr(“height”);
var img_h_m = img_h – 30;
var img_src = img.attr(“src”);
img.css(‘display’ , ‘none’);
var paper = Raphael(this, img_w, img_h);
// iOS devices can not apply path background image correctly. We are using clipping instead.
if ($.browser.safari){
var p = “M0,30L”+img_w+”,0L”+img_w+”,”+img_h_m+”L0,”+img_h+”L0,30″;
var p_img = paper.image(img_src, 0, 0, img_w, img_h);
p_img.attr({
stroke: “none”,
“clip-rect”: p
});
}
else{
var c = paper.path(“M 0 30 L “+img_w+” 0 L “+img_w+” “+img_h_m+” L 0 “+img_h+” L 0 30″);
c.attr({
stroke: “none”,
fill: “url(“+img_src+”)”
});
}
});
// Swap HomePage thumbnails with vector objects
$(“.slide-h”).each(function () {
var img_w = $(this).find(“img”).attr(“width”);
var img_h = $(this).find(“img”).attr(“height”);
var img_h_m = img_h – 15;
var img_src = $(this).find(“img”).attr(“src”);
var paper = Raphael(this, img_w, img_h);
if ($.browser.safari){
var p = “M0,15L”+img_w+”,0L”+img_w+”,”+img_h_m+”L0,”+img_h+”L0,15″;
var img = paper.image(img_src, 0, 0, img_w, img_h);
img.attr({
stroke: “none”,
“clip-rect”: p
});
}
else{
var c = paper.path(“M 0 15 L “+img_w+” 0 L “+img_w+” “+img_h_m+” L 0 “+img_h+” L 0 15″);
c.attr({
stroke: “none”,
fill: “url(“+img_src+”)”
});
}
});
});
/************************************************************************************************************************************************/
/* Hover holder for svg-objects */
$(function() {
$(‘#multicol:not(.portfolio_massonry) .img-holder, #multicol-gal .img-holder’).append(‘
‘).each(function () {
var $span = $(‘> div.i-am-overlay:not(.highslide-maincontent)’, this);
if ($.browser.msie && $.browser.version < 9)
$span.hide();
else
$span.css(‘opacity’, 0);
$(this).hover(function () {
if ($.browser.msie && $.browser.version < 9)
$span.show();
else
$span.stop().fadeTo(500, 1);
}, function () {
if ($.browser.msie && $.browser.version < 9)
$span.hide();
else
$span.stop().fadeTo(300, 0);
});
});
});
/****************************************************************************************************************/
/* Hoovers for svg-objects */
$(function() {
// Add rollovers to gallery-posts thumbnails
var slideshow_group_counter = 100;
$(“#multicol:not(.portfolio_massonry) .img-holder:not(.n-s) div.i-am-overlay”).append(‘‘).each(function () {
$(‘a.detal’, this).attr(‘href’, $(this).parent(‘div’).find(‘a’).attr(‘href’));
elems = $(this).parents(“.article”).find(“.gal_in_posts a”);
var group = ‘group’+slideshow_group_counter;
var tid = ‘for_’+group;
elems.eq(0).attr(“id”, tid);
slideshow_group_counter++;
var slideshow_options_bak = {};
$.extend(slideshow_options_bak, gallery_slideshow);
gallery_slideshow.slideshowGroup = group;
hs.addSlideshow(slideshow_options_bak);
$(‘a.zoom-gal’, this).attr(‘href’, ‘javascript:;’).attr(‘onclick’, ‘document.getElementById(”+tid+”).onclick()’);
elems.each(function () {
$(this).addClass(“hs_attached”);
if (!$(this).attr(“href”))
return;
this.onclick = function () {
gallery_group.slideshowGroup = group;
gallery_group.thumbnailId = tid;
return hs.expand(this, gallery_group);
};
});
var item_info = $(this).parents(“.article”).find(“.photo-info”);
item_info.css(‘display’,’none’);
var info_box = $(this).find(“a.detal”);
info_box.hover(function() {
item_info.stop().fadeTo(400,1);
}, function() {
item_info.stop().fadeTo(200,0, function() { item_info.hide() });
});
var img_w = $(this).parent(“div”).width();
var img_h = $(this).parent(“div”).height() + 2;
var img_h_m = img_h – 30;
var paper = Raphael(this, img_w, img_h);
if ($.browser.safari){
var p = “M0,30L”+img_w+”,0L”+img_w+”,”+img_h_m+”L0,”+img_h+”L0,30″;
var p_img = paper.image(gal_h, 0, 0, img_w, img_h);
p_img.attr({
stroke: “none”,
“clip-rect”: p
});
}
else{
var c = paper.path(“M 0 30 L “+img_w+” 0 L “+img_w+” “+img_h_m+” L 0 “+img_h+” L 0 30″);
c.attr({
stroke: “none”,
fill: “url(“+gal_h+”)”
});
}
});
// Add rollovers to regular-posts thumbnails
$(“#multicol:not(.portfolio_massonry) .img-holder.n-s div.i-am-overlay”).append(‘‘).each(function () {
$(‘a.detal’, this).attr(‘href’, $(this).parent(‘div’).find(‘a’).attr(‘href’));
$(‘a.zoom’, this).attr(‘href’, $(this).parent(‘div’).find(‘a’).attr(‘data-img’));
var img_w = $(this).parent(“div”).width()+18;
if ($.browser.msie)
var img_h = $(this).parent(“div”).height();
else
var img_h = $(this).parent(“div”).height()+2;
var img_h_m = img_h – 30;
var paper = Raphael(this, img_w, img_h);
if ($.browser.safari){
var p = “M0,30L”+img_w+”,0L”+img_w+”,”+img_h_m+”L0,”+img_h+”L0,30″;
var p_img = paper.image(gal_h, 0, 0, img_w, img_h);
p_img.attr({
stroke: “none”,
“clip-rect”: p
});
}
else{
var c = paper.path(“M 0 30 L “+img_w+” 0 L “+img_w+” “+img_h_m+” L 0 “+img_h+” L 0 30″);
c.attr({
stroke: “none”,
fill: “url(“+gal_h+”)”
});
}
});
$(“#multicol-gal.two_level_gal .img-holder div.i-am-overlay”).append(‘‘).each(function () {
var item_info = $(this).parents(“.article”).find(“.photo-info”);
item_info.css(‘display’,’none’);
var info_box = $(this).find(“a.detal”);
info_box.hover(function() {
item_info.stop().fadeTo(400,1);
}, function() {
item_info.stop().fadeTo(200,0, function() { item_info.hide() });
});
var img_w = $(this).parent(“div”).width();
var img_h = $(this).parent(“div”).height() + 2;
var img_h_m = img_h – 30;
var paper = Raphael(this, img_w, img_h);
if ($.browser.safari){
var p = “M0,30L”+img_w+”,0L”+img_w+”,”+img_h_m+”L0,”+img_h+”L0,30″;
var p_img = paper.image(gal_h, 0, 0, img_w, img_h);
p_img.attr({
stroke: “none”,
“clip-rect”: p
});
}
else{
var c = paper.path(“M 0 30 L “+img_w+” 0 L “+img_w+” “+img_h_m+” L 0 “+img_h+” L 0 30″);
c.attr({
stroke: “none”,
fill: “url(“+gal_h+”)”
});
}
});