Re: HTML widgets in sidebars?

Posted by Pedro on
URL: https://support.nabble.com/HTML-widgets-in-sidebars-tp7580917p7580986.html

Harvey44 wrote
I'd like to put my ad above the adsense ad.
1- Go to sidebar_widget -> Remove override
2 - Let's put that code in a individual macro. Create a new one like this:
<macro name="h_widget">
    <n.put_in_head.>
		<script type='text/javascript'>
			$(document).ready(function(){
				var footer_pos = $("table.footer-table").position().top;
				var ad_pos = $("div.ad").position().top;
				var ad_h = 220;
				var widget_h = 272;
				if(footer_pos - ad_pos > (ad_h +widget_h))
					$("#h-widget").show();
			});
		</script>
	</n.put_in_head.>    
	<div id='h-widget' class="invisible">
		<div style="text-align: center;">
		<a href="http://www.nelsap.org/book.html" rel="nofollow" target="_blank"><img src="http://nyskiblog.com/wp-content/uploads/2012/07/Lost-Ski-Areas-Southern-Adirondacks.jpg" style="border: solid #000000; border-width: 1px" alt="Lost Ski Areas of S Adk" width="180"/></a>
		</div> 
		<div style="color: #ffffff; text-align: center;"> <span style="font-size: normal;">Order Your Copy Today!</span></div>  
    </div> 
</macro> 
3 - Edit your ads_widget macro to call it before the ads. Like this:
<override_macro name="ads_widget">
	<n.h_widget/>
	<n.widget.>
		<n.show_ad location="widget" />
	</n.widget.>
</override_macro>
My test forum.