本文介绍了在所有$(document).ready()运行之后,有没有相应的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的index.php页面中包含一个first.js文件,其内容如下:

I have a first.js file included in the page index.php that have something like this:

$(function(){

    $("#my_slider").slider("value", 10);

});

在index.php中,它们有一些动态创建的滑块:

And them in index.php I have some dynamicly created slidders:

<?php function slidders($config, $addon)
{
    $return = '
    <script type="text/javascript">
        $(function() {
            $("#slider_'.$addon['p_cod'].'").slider({
            min: '.$config['min'].',
            max: '.$config['max'].',
            step: '.$config['step'].',
            slide: function(event, ui) {
                $("#cod_'.$addon['p_cod'].'").val(ui.value);
                $(".cod_'.$addon['p_cod'].'").html(ui.value+"'.@$unit.'");
            },
            change: function(event, ui) { 
                $("#cod_'.$addon['p_cod'].'").change();
            }
        });
            $("#cod_'.$addon['p_cod'].'").val($("#slider_'.$addon['p_cod'].'").slider("value"));
            $(".cod_'.$addon['p_cod'].'").html($("#slider_'.$addon['p_cod'].'").slider("value")+"'.@$unit.'");
    });
    </script>';
    return $return;
} ?>

问题是,因为在我的first.js之后无法实例化我的index.php滑块,所以我无法在此处设置值,是否有类似所有$(document).ready()运行之后"的事件?我可以在first.js中使用它来操纵在index.php中创建的滑块?

The problem is, because my index.php sliders are being instantiated after my first.js I can't set up a value there, is there any event like "after all $(document).ready() have run" that I can use in first.js to manipulate the sliders created in index.php?

推荐答案

不知道如何知道最后一个$(document).ready()函数何时触发,但是$(window).load()函数在$(document).ready()

Dont know how to tell when the last $(document).ready() function fired, but $(window).load() function fires after the $(document).ready()

这篇关于在所有$(document).ready()运行之后,有没有相应的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 08:22