我已经查看了许多将数据从Javascript传递到Magnific弹出窗口的示例,当鼠标离开屏幕时,弹出窗口将触发1次,然后您将不得不刷新页面。 但是我不能让弹出窗口有动画或有效。 我想使用mfp-3d-unfold或mfp-zoom-out作为效果和#test-popup div id作为内容 有人可以帮助我如何修复代码..我真的很困惑这一点。 TKS
<html>
<head>
<title> Test leave Screen New 2</title>
<script type='text/javascript' src='js/jquery-1.10.2.min.js'></script>
<link rel='stylesheet prefetch' href='magni/magnific-popup.css'>
<link rel="stylesheet" href="magni/magnimain1.css" media="all">
<script src="magni/prefixfree.min.js"></script>
<script>
visitchecka = 0;
$(document).on('mouseleave', leaveFromTop);
function leaveFromTop(e){
if( e.clientY < 0 ) // less than 60px is close enough to the top
if (visitchecka < 1 ) {
visitchecka++;
visitchecka++;
// window.location='#test-popup'.css;
$.magnificPopup.open({
items : {
mainclass: 'mfp-zoom-out',
src: '#test-popup',
},
type: 'inline',
});
}
}
</script>
</head>
<body>
<div class="links">
<h4>Text-based:</h4>
<ul id="inline-popups">
<li><a href="#test-popup" data-effect="mfp-3d-unfold">3d unfold</a></li>
<li><a href="#test-popup" data-effect="mfp-zoom-out">Zoom-out</a></li>
</ul>
<a href="#test-popup" class="hinge">Popup with "hinge" close effect</a> (based on animate.css)
</div>
<!-- Popup itself -->
<div id="test-popup" class="white-popup mfp-with-anim mfp-hide">You may put any HTML here. This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.foofoo</div>
<script src='magni/jquery.min213.js'></script>
<script src='magni/jquery.magnific-popup.min.js'></script>
<script src="magni/index.js"></script>
</body>
</html>
答案 0 :(得分:0)
你可以使用name = fields.Char(compute='comp_name', store=True)
只需调用你的元素来触发点击,弹出窗口就会打开... here我为你做了一个例子..
@api.depends('first_name','last_name')
def comp_name(self):
self.name = (self.first_name or '')+' '+(self.last_name or '')