1

Please help me to fix this.

I have a link with the code http://jsfiddle.net/vop50rct/ its working fine in jsfiddle, but if i put the same thing in localhost its not working any specific reason? i also checked javascripts and jquery everything is embedded correctly (other jsfiddle code works fine).

can anyone guide me on how to place this code.

HTML:

<head>
    <title>Page</title>  
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" media="screen" rel="stylesheet" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
</head>

jQuery:

_mouseDrag: function(event) {
    var self = this;
    this.dragged = true;

    if (this.options.disabled)
      return;

    var options = this.options;

    var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
    if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
    if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
    this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});

    this._trigger("drag", event);

    return false;
},
4
  • What exactly don't work? Commented Jun 24, 2015 at 10:26
  • Do you have any error in your console? Commented Jun 24, 2015 at 10:28
  • jquery/1.3.2.. Are you sure the jQuery versions match? Commented Jun 24, 2015 at 10:48
  • I have no error for console time, it's execute successfully. but mouse drag event is not working. and also jQuery version is match. Commented Jun 24, 2015 at 11:42

2 Answers 2

1

I resolved the issue.

i put in all jQuery code in to document.ready function.

    $(document).ready(function() {
do your code here....
}
Sign up to request clarification or add additional context in comments.

Comments

0

How do you embed your JQuery code into you HTML file? From your HTML fragment I can see that you load only JQuery related scripts, but you JQuery code is not executed anywhere.

You can browse to your jsfiddle sample and have a look how the final code (in the result frame) is assembled.

2 Comments

Thanks for your response.. Please check jsfiddle.net/vop50rct link, I used same code for that. In jsfiddle it's working fine but not working in my site.
I have copied the generated source from the result frame in jsfiddle and pasted it to separate file demo.html. When I one demo.html in Chrome, it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.