How can I make a div clickable over the entire background image?


Vignesh Pichamani

I added a background image to the parent divdiv width and 100%I redirect when you click on the div (everything works), but I only want to redirect the div when you click from left to right. 100px;For example, here is a fiddle I call a div with a background image, and whenever I click on any part of the div, it gets redirected. But my problem is that I want to redirect only if you click the image from left to right inside. 100px;Is it possible to implement any suggestion would be great. http://jsfiddle.net/a39Va/25/

$('#loginContainer').click(function(e) { 

    window.open('http://google.com');
});

thanks.

Jitendra Pancholi

Please try the following ( http://jsfiddle.net/a39Va/31/ )

 <div id="loginContainer">
      <div class="clickable"></div>
    </div>

CSS

.clickable{
    width:100px;
    height:100%;

}

JS

$('.clickable').click(function(e) { 

    window.open('http://google.com');
});

Related


How can I make a div clickable over the entire background image?

Vignesh Pichamani I added a background image to the parent divdiv width and 100%I redirect when you click on the div (everything works), but I only want to redirect the div when you click from left to right. 100px;For example, here is a fiddle I call a div wit

How can I make a div clickable over the entire background image?

Vignesh Pichamani I added a background image to the parent divdiv width and 100%I redirect when you click on the div (everything works), but I only want to redirect the div when you click from left to right. 100px;For example, here is a fiddle I call a div wit

How can I make the gradient background cover the entire div?

IPG Mediabrands NL I'm trying to make the site easier to read. I managed to overlay the photo with a background gradient to make the letters more visible. The problem is that the background gradient doesn't cover the entire div/image. Here is the code: #us_gri

How can I make the gradient background cover the entire div?

IPG Mediabrands NL I'm trying to make the site easier to read. I managed to overlay the photo with a background gradient to make the letters more visible. The problem is that the background gradient doesn't cover the entire div/image. Here is the code: #us_gri

How to make entire div clickable

Max Ruth I'm making a menu and have a simple and stupid question. The problem is: I put the <span>element in the "menu" div. with ID '#menu'. I've provided a function by which you can accidentally click inside <a>the <span>pierce CSS . But now, if you click on

How to make entire div clickable

00 11 Basically what I do is, I make a web ad in After Effects and want to put it in HTML. If a user clicks on my ad, they will be taken to a companion site of your choice. So I want the whole div to be clickable and make it link to another site. Use javascrip

How to make entire div clickable

Max Ruth I'm making a menu and have a simple and stupid question. The problem is: I put the <span>element in the "menu" div. with ID '#menu'. I've provided a function by which you can accidentally click inside <a>the <span>pierce CSS . But now, if you click on

How to make entire div clickable

Max Ruth I'm making a menu and have a simple and stupid question. The problem is: I put the <span>element in the "menu" div. with ID '#menu'. I've provided a function by which you can accidentally click inside <a>the <span>pierce CSS . But now, if you click on

How to make entire div clickable

00 11 Basically what I do is, I make a web ad in After Effects and want to put it in HTML. If a user clicks on my ad, they will be taken to a companion site of your choice. So I want the whole div to be clickable and make it link to another site. Use javascrip

How to make entire div clickable

00 11 Basically what I do is, I make a web ad in After Effects and want to put it in HTML. If a user clicks on my ad, they will be taken to a companion site of your choice. So I want the whole div to be clickable and make it link to another site. Use javascrip

How to make entire div clickable

Max Ruth I'm making a menu and have a simple and stupid question. The problem is: I put the <span>element in the "menu" div. with ID '#menu'. I've provided a function by which you can accidentally click inside <a>the <span>pierce CSS . But now, if you click on

How to make entire div clickable

Max Ruth I'm making a menu and have a simple and stupid question. The problem is: I put the <span>element in the "menu" div. with ID '#menu'. I've provided a function by which you can accidentally click inside <a>the <span>pierce CSS . But now, if you click on

How to make entire div clickable

00 11 Basically what I do is, I make a web ad in After Effects and want to put it in HTML. If a user clicks on my ad, they will be taken to a companion site of your choice. So I want the whole div to be clickable and make it link to another site. Use javascrip

How to make entire div clickable

00 11 Basically what I do is, I make a web ad in After Effects and want to put it in HTML. If a user clicks on my ad, they will be taken to a companion site of your choice. So I want the whole div to be clickable and make it link to another site. Use javascrip