0

Over a Frontpage i use a Colorbox. (Colorbox-Node Module - Drupal7) In this Box opens a Klynt Project (http://www.klynt.net/) - like a Video. To open it directly from the page view I use this script in a Block.

<script type="text/javascript">
    // <![CDATA[

        jQuery(document).ready(function($) {
            $('.colorbox-node').triggerHandler("click");
        });

    // ]]>
 </script>

is it possible to hook a cookie so that 'click' would be triggered only once per user?

Thanks!

4

1 回答 1

0

首先使用 jQuery 的一些 cookie 插件,如下所示: jQuery cookie plugin

然后像这样重写你的代码:

<script type="text/javascript">// <![CDATA[
jQuery(document).ready(function($) {
  if (!$.cookie('was_here') ) {
    $.cookie('was_here', true);
    $('.colorbox-node').triggerHandler("click");
  }
});
// ]]></script>

这应该可以解决问题。

于 2013-09-18T14:15:53.933 回答