• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Click on image B without affect image A

Participant ,
Apr 01, 2019 Apr 01, 2019

Copy link to clipboard

Copied

I have one image (pink "B") included and over another (blue "A") like the follow exemple.

I need to click (onClick) over B and play a sound without play another  sound conect to the image A.  

At my level if I clik on B Is the sound of A ("playThis") that play.

Is there a way to click on B and do not "play" A?

The Image A

<style>   

#Image1{

top: x1px;   

left: x2px;

width: x3px;

height: x4px;

position: absolute;

background-image: y

}

</style>

   

The Image B is set in similar way.

<div onClick ="PlayThis()" id = "ImageA'"></div>

<div onClick ="PlayThat()" id = "ImageB'"></div>

Senza titolo-7.jpg

Views

394

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 01, 2019 Apr 01, 2019

One way would be to move your onClick events to a <span> tag:

<div  id="Image1">

<span onClick="playThis()"></span>

<div id="Image2">

<span onClick="playThat()"></span>

</div>

<!-- end Image2 -->

</div>

<!-- end Image1 -->

Then style the span tags so they cover their parent container area:

#Image1 span, #Image2 span {

display: block;

height: 100%;

}

Votes

Translate

Translate
LEGEND ,
Apr 01, 2019 Apr 01, 2019

Copy link to clipboard

Copied

One way would be to move your onClick events to a <span> tag:

<div  id="Image1">

<span onClick="playThis()"></span>

<div id="Image2">

<span onClick="playThat()"></span>

</div>

<!-- end Image2 -->

</div>

<!-- end Image1 -->

Then style the span tags so they cover their parent container area:

#Image1 span, #Image2 span {

display: block;

height: 100%;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 02, 2019 Apr 02, 2019

Copy link to clipboard

Copied

LATEST

Thank you very much Osgood!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines