Home>
I'd like to divide the event (class acquisition) generated by clicking into div. I don't know what to do. Please teach me.
<html>
<head>
<style>
.video-frame {
position: relative;
width: 100%;
overflow: auto;
-webkit-overflow-scrolling: touch;
border: 1px solid #ccc;
}
.video-frame__video--click {
padding-top: 56.25%;
position: relative;
width: 100%;
overflow: auto;
-webkit-overflow-scrolling: touch;
border: 1px solid #ccc;
}
.video-frame__video--click iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
display: block;
}
.video-frame img {
max-width: 994px;
width: 100%;
}
</style>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<!-Video 1->
<!-Video 2->
<script>
$('. video-frame__video'). click (function () {
var vframe = '';
$(this) .replaceWith (vframe);
$('. video-frame'). attr ('class', 'video-frame__video--click');
/ * ↑ This will change the class of both video 1 and video 2 when clicked.
I want to change the class of video 1 when I click video 1 and video 2 when I click video 2
* /
});
</script>
</body>
</html>
-
Answer # 1
-
Answer # 2
$('. video-frame')
⇒$(this) .parent ()
Related articles
- javascript - i want to measure event tracking when i click a button
- javascript - how to send parameter in click event in js
- javascript click event handler is not called when iframe element is clicked
- javascript - i want to display the hamburger menu with the click () event in jquery, but it is not displayed
- javascript - event to click the scroll bar
- javascript - pseudo chat using click event and timer processing
- javascript - event handling on click
- javascript - i want to realize a click event with addeventlistner
- javascript - i want to fire the scroll event only once in each function
- javascript - i want to display the characters when i click the leaflet circle
- php - i want to raise javascript event in all table in loop of html (blade of laravel)
- javascript - change text with vuejs v-for, @click
- javascript - [jquery] how to raise an event both when loading and scrolling
- vbnet - i want to summarize the click event of control on the panel
- javascript - when i click on the next month and the previous month on the calendar, the previous calendar display remains
- vba - to replace the "me" in the click event code that was moved to the access standard module
- it is not reflected even if i click it with javascript
- javascript - click an image to move to the next image jquery (mail order site product details screen)
- javascript - i want to repeat a function that has event processing
- javascript - event that bundlejs is not output when using webpack
Trends