Jump to content

Html Background Click ?


Manixat

Recommended Posts

  • 11 months later...

hi .manixat

To accomplish this, you may get solutions like adding <a> around <div>. But it won’t be a good practice as per standard. Finally you may end up with replacing <div> with <IMG>.  But you will never get the desired output.

But my solution is quite simple. Make it clickable with JavaScript.

Simple Jquery Solution is

 

$(document).ready(function() {

$("div.js-ad-home-page-background").click(function(event){

window.open('LINK_TO_ADVERTISE');

});

});

Common Issues

Ad links will won’t work if there is no JavaScript(which is not at all happen now days) and if any JS error in page. Which are common. So make sure that no script error before this jQuery snippet

Note:

Make sure that you have added jquery.js

let me know if it helps

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.