Rich-text Reply

Make image clickable

hal2018 04-17-18
Accepted Solution

Make image clickable

Hi, 

I've added an image in our website menu and would like this image to be clickable. Is this possible via Optimizely? I have created a div but I am unable to add the image within the div.

 

Are there any solutions to this? As I have realised when you add images in Optimizely you can't uniquely call out that image it just allows you to add the image at a certain position etc.

 

 

Level 2

CouchPsycho 04-17-18
 

Re: Make image clickable

Hi,

it is and it is even quite simple if you are using javascript. Do you have a page, where one can already see something. Does the div have an ID?

Kind regards

Michael
Kind regards

Michael


   
hal2018 04-17-18
 

Re: Make image clickable

Hi, 

Thanks for your reply. Well for this specific test it will be sitting in the burger menu under Home at the bottom. The div id is #editedbm 

the div has nothing in it I've just created a div and then inserted the image after home link. 

 

http://www.beautybay.com/?optimizely_token=be3b521046dccdf95c3d7d8a5e4dcd38bf7344e74cd17971187243cbc...

 

@CouchPsycho

 

 

Level 2
CouchPsycho 04-17-18
 

Re: Make image clickable

[ Edited ]

Hi,

 

you can add an image with a link to that DIV by using:

 

jQuery("#editedbm").append("<a href='http://www.google.de'><img src='//www.google.de/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png' /></a>");

 

It seems, that your navigation is not present in the DOM while the menu ist closed, correct?

Kind regards

Michael


   
hal2018 04-17-18
 

Re: Make image clickable

Thats correct it's not present in the DOM. loads when customer clicks on the menu icon so I have a javascript function which activates the experience when customer clicks on the menu. 

 

jQuery("#editedbm").append("<a href='https://www.beautybay.com/edited/'><img src='//cdn.optimizely.com/img/8409053680/a2c28514229a4588ad2a031784d57296.jpg' /></a>"); 

 

^ I've added the above however I'm not sure if the img source syntax is correct as currently the image is just saved locally in my documents. 

 

Thanks,

Halima

Level 2
CouchPsycho 04-17-18
 

Re: Make image clickable

as long as you provide an url which is accessible by everyone else, it should work :-)

Kind regards

Michael