hi Pals,
I have a problem regarding the “target” attribute of “a” tag. in my code I use biggerlink jQuery script to give link to p element without come HTML validation problem. I pass the “target” value from PHP to smarty template , but it’s not working , When I remove "biggerlink " it works but the link in <p> tag not working . My Tpl file is :
{if not empty($campaign)}
<div class="securti-adv biggerlink">
{if not empty ($campaign.media)}
<a href="{$campaign.url}"
{if n($campaign.linkTarget)}target=“{$campaign.linkTarget}”{/if}
class="thumb">
<img src="{$campaign.image}" title="{$campaign.title1 + $campaign.title2}" alt="{$campaign.title1 + $campaign.title2}" /> </a>
{/if}
<div class="details">
{if not empty ($campaign.title1) || not empty ($campaign.sub_title)}
<a href="{$campaign.url}"
{if not empty($campaign.linkTarget)}target=“{$campaign.linkTarget}”{/if}
title="{$campaign.title1 + $campaign.title2}">
{text2image styleSlug=$campaign.titleStyle1 text=$campaign.title1}
{text2image styleSlug=$campaign.titleStyle2 text=$campaign.title2}
<span><img src="{$imagesDir}/btn-campaign-meet-security-advisor.png" alt="" title="" /></span>
</a>
<p> {text2image styleSlug=$campaign.subtitleStyle text=$campaign.subTitle}</p>
{/if}
</div>
</div>
<script type="text/javascript" language="javascript">
{literal}
$(document).ready(function(){
$('.biggerlink').biggerlink();
});
{/literal}
</script>
{/if}
My plugin code is :
(function($) {
$.fn.biggerlink = function(options) {
// Default settings
var settings = {
hoverclass:'hover', // class added to parent element on hover
clickableclass:'hot', // class added to parent element with behaviour
follow: true // follow link? Set to false for js popups
};
if(options) {
$.extend(settings, options);
}
$(this).filter(function(){
return $('a',this).length > 0;
}).addClass(settings.clickableclass).each(function(i){
// Add title of first link with title to parent
$(this).attr('title', $('a[title]:first',this).attr('title'));
// hover and trigger contained anchor event on click
$(this)
.mouseover(function(){
window.status = $('a:first',this).attr('href');
$(this).addClass(settings.hoverclass);
})
.mouseout(function(){
window.status = '';
$(this).removeClass(settings.hoverclass);
})
.bind('click',function(){
$(this).find('a:first').trigger('click');
})
// triggerable events on anchor itself
.find('a').bind('focus',function(){
$(this).parents('.'+ settings.clickableclass).addClass(settings.hoverclass);
}).bind('blur',function(){
$(this).parents('.'+ settings.clickableclass).removeClass(settings.hoverclass);
}).end()
.find('a:first').bind('click',function(e){
if(settings.follow == true)
{
window.location = this.href;
}
e.stopPropagation(); // stop event bubbling to parent
}).end()
.find('a',this).not(':first').bind('click',function(){
$(this).parents('.'+ settings.clickableclass).find('a:first').trigger('click');
return false;
});
});
return this;
};
})(jQuery);
the value of “target” , “_blank” is not work … I highlight the code part regarding this, please check and give me a solution ASAP. You can mail me at : anes.pa@gmail.com
Thanks,
Anes