jaymin
jaymin

Reputation: 23

How to select particular text using touch device and highlight?

In touch device I need to select particular text from div or p and after that user selected text must be highlight.

I'm using jQuery textHighlighter.

Is it possible?

Below tried this code it works on non touch device but not properly work in touch device

$(".ParagraphText").textHighlighter({
//$(".ParagraphText").textHighlighter({
    onRemoveHighlight: function(highlight) {
        return true;
    },
    onBeforeHighlight: function(range) {
        return true;
    },
    //when text is selected make it draggable
    onAfterHighlight: function(highlights, range) {
        //logger("onAfterHighlight...");
        $(".ParagraphText").find(".SelectedText").removeClass("SelectedText")

        $(".HighlightText"+highlighClass).addClass("SelectedText");
        SelectedText = "HighlightText"+highlighClass;
        $("#btnClearColor").show();
        $("#btnClearColor").css('background-color',mycolor);

        $(".HighlightText"+highlighClass).draggable({
            helper: 'clone',
            appendTo: '#paraLi',
            containment: "#myDragDiv",
            revert: true,
            scroll:false,
            cursorAt: { top: 13, left: 13 },
            start: function(event,ui){
                //logger('Inside start.');
                $(".HighlightText"+highlighClass).css( "zIndex", 10000 );
            },
            drag: function(event,ui){
                //logger('Inside drag.');
            }
        });// HighlightText"+highlighClass draggable complete.

    }//Complete onAfterHighlight
});//Complete textHighlighter

Upvotes: 1

Views: 240

Answers (0)

Related Questions