calebjacob / tooltipster

A jQuery tooltip plugin
MIT License
2.76k stars 480 forks source link

Tool tip not showing on first hover #748

Closed johndavemanuel closed 5 years ago

johndavemanuel commented 6 years ago

I am using tooltipster for thr first time.

I have this code

$('body').on('mouseenter', '.doreming-task', function(e) {
            var documentWidth = $(document).width();
            var documentHeight = $(document).height();
            var currentID = $(this).attr("event_id");
            var atr = scheduler.getEvent(currentID);
            var taskTitle = atr.text;
            var taskDesc = atr.description;
            var taskstartDuration = atr.start_date;
            var taskendDuration = atr.end_date;

            var taskdatetimeduration = scheduler.templates.tooltip_date_format(taskstartDuration).split(" ")[1] + " " + scheduler.templates.tooltip_date_format(taskstartDuration).split(" ")[2] + " - " +
                scheduler.templates.tooltip_date_format(taskendDuration).split(" ")[1] + " " + scheduler.templates.tooltip_date_format(taskendDuration).split(" ")[2];

            var taskAssign = atr.person;
            var taskProject = atr.project_id;
            var taskGroup = atr.management_id;
            var taskLocation = atr.work_location_name;
            var taskContent = atr.work_category;

            var contents_name = "";
            var management_name = "";

            $.each(workContentsHolder, function(key, val) {
                if (taskContent == val['id']) {
                    contents_name = val['name'];
                    return false;
                } else {
                    contents_name = " ";
                }
            });
            $.each(departmentHolder, function(key, val) {
                if (taskGroup == val['id']) {
                    management_name = val['name'];
                    return false;
                } else {
                    management_name = " ";
                }
            });

            $("#task-title-holder").text(taskTitle);
            $("#task-duration").text(taskdatetimeduration);
            $("#task-description-holder").text(taskDesc);
            $("#task-assign-holder").text(taskAssign);
            $("#task-project-holder").text(taskProject);
            $("#task-group-holder").text(management_name);
            $("#work-content-holder").text(contents_name);
            $("#work-location-holder").text(taskLocation);

            $(this).tooltipster({
                animation: "fade",
                delay: 100,
                trigger: 'hover',
                content: $('#tooltip_content'),
                arrow: false,
                contentAsHTML: true,
                repositionOnScroll: true,
                trackTooltip: true,
                contentCloning: true,
                theme: 'tooltipster-shadow',
                multiple: false,
            })
        });

Basically, I just get the "event_id", get all the details, append in the HTML holder and put it on the content, it is working fine but it is always on the second hover

Any help and assistance will be appeciated

louisameline commented 5 years ago

Please check the FAQ about delegation. Thank you