Issue with jQuery / script for a background image

BetOnlineUK

Affiliate Guard Dog Member
Joined
Jun 8, 2016
Messages
431
Reaction score
202
Hi All,

I am hoping someone could help with this issue. I currently have a background image on one of my sites, which needs to be clickable to another site.

I have been using the below code which did use to work but for some reason it no longer is.

<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#main-container').click(function(e) {
if( e.target !== this )
return;
window.open('https://www.xxxxxxx.com');
});
});
</script>

Anyone got any ideas why?
 

Jetman

Affiliate Guard Dog Member
Joined
Nov 8, 2019
Messages
138
Reaction score
67
Hey,

I honestly don't know a lot about coding, but if you are using wordpress I do know a workaround.
 

BetOnlineUK

Affiliate Guard Dog Member
Joined
Jun 8, 2016
Messages
431
Reaction score
202
Hey,

I honestly don't know a lot about coding, but if you are using wordpress I do know a workaround.
I am using Wordpress, it is on my main site https://bettingoffers.bet and the background is around the main page (green image).

Any help would be appreciated.
 

Jetman

Affiliate Guard Dog Member
Joined
Nov 8, 2019
Messages
138
Reaction score
67
I was not expecting the images to be around the main page but rather inside an article. I guess I misinterpreted your question. Can you edit this image from within your regular article editor page? If you can, than you can edit the image to contain a link.
 

BetOnlineUK

Affiliate Guard Dog Member
Joined
Jun 8, 2016
Messages
431
Reaction score
202
Unfortunately not it is tied in with the theme, hence needing a script to be able to pick it up which used to work.
I have no idea when it comes to scripts if it is outdated or corrupt.
I am hoping someone can help, but the site is changing in the next 6 weeks or so, so no biggie but wanted to know why it has stopped working.

Cheers
 

ddm

Former Member
Joined
Nov 16, 2018
Messages
489
Reaction score
287
Hi All,

I am hoping someone could help with this issue. I currently have a background image on one of my sites, which needs to be clickable to another site.

I have been using the below code which did use to work but for some reason it no longer is.

<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#main-container').click(function(e) {
if( e.target !== this )
return;
window.open('https://www.xxxxxxx.com');
});
});
</script>

Anyone got any ideas why?
not sure how this can work

you are targeting the whole main container with that id selector, not the stuff outside the main container.

also, vanilla JS > Jquery :)
 

BetOnlineUK

Affiliate Guard Dog Member
Joined
Jun 8, 2016
Messages
431
Reaction score
202
not sure how this can work

you are targeting the whole main container with that id selector, not the stuff outside the main container.

also, vanilla JS > Jquery :)
It did work at some stage in the past and not sure when it stopped working, coding is not my thing so clueless.

Not to worry, better crack on with the redesign ;)
 

AussieDave

24 years & still going!
Joined
Nov 28, 2013
Messages
4,993
Reaction score
3,533
ohhh, very helpfull. thx u

New member:
Joined Yesterday at 11:31 PM

Last seen Yesterday at 11:41 PM

Manages to post 4x in 10 min, and every posted message is the same dribble: "ohhh, very helpfull. thx u".
 
Top