我有一些代码,可在单击叠加图像后自动开始播放视频。问题在于单击后,整个页面将移至顶部,而视频在页面的下方继续播放。原因是什么?如何防止这种情况发生,并允许视频在最初单击的位置播放?
以下是指向密码笔的链接(向下滚动以观看视频):https://codepen.io/NewbCake/pen/qMMQZo
这取决于Jquery和Fitvids
谢谢您的帮助!
HTML
hostname_or_ip 4
other_hostname
third_hostname 2
CSS
<script>
function geoFindMe() {
var coordinates = document.getElementById("coordinates");
if (!navigator.geolocation) {
alert("Geolocation is not supported by your browser");
return;
}
function success(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var coordinates = [longitude, latitude];
document.getElementById("coordinates").value = coordinates;
var xhttp = new XMLHttpRequest();
xhttp.open("POST",URL, true);
xhttp.setRequestHeader('Content-type','application/json; charset=utf-8');
xhttp.send(JSON.stringify({"coordinates":coordinates}));
}
function error() { alert("Unable to retrieve your location"); }
navigator.geolocation.getCurrentPosition(success, error);
}
</script>
JS
var data = require('data.js');
app.post("/", (req, res) => {
const newUser = new data({
geometry: {
type:'Point',
coordinates: req.body.coordinates
}
});
newUser.save(err => {
if (err) return res.status(500).send(err);
return res.status(200).send("your success message");
});
答案 0 :(得分:0)
尝试使用javascript:
代替#
:
<a href="javascript:" id="btn_play" class="btn">