jQuery:仅运行一次

编程入门 行业动态 更新时间:2024-10-28 16:25:02
本文介绍了jQuery:仅运行一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是的,我有一个fancybox.如果?mode = new

Yes i have an fancybox. It auto opens if ?mode=new

在?mode = new上发生的是:

What happens on ?mode=new is:

<script> $(document).ready(function(){ $('#newPM').click(); }); </script>

打开正常.但是,当您单击该元素时,该元素将保持关闭/打开状态,因为这已激活.那我怎么只能运行一次呢?

It opens fine. But when you then click on the element, it keeps closing/open, because this is activated. So how can i only run this once?

推荐答案

您是说它不断打开和关闭fancybox吗?您可以

Do you mean it keeps opening and closing the fancybox? You can do

$("#newPM").unbind("click");

这将删除onclick事件,使其不再被触发.

This will remove the onclick event so it doesn't get triggered anymore.

更多推荐

jQuery:仅运行一次

本文发布于:2023-10-29 10:47:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539484.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:jQuery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!