tilfin / jquery-scrollview

Automatically exported from code.google.com/p/jquery-scrollview
0 stars 0 forks source link

Enable / disable function #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Is there a way/function that i call to toggle the grab-and-drag capabilities?

I'm using:
 - jQuery v1.3.2
 - jQuery scrollview plugin 0.1

Any suggestions would be much appreciated!

Thanx,

Armand

Original issue reported on code.google.com by yogato...@gmail.com on 29 Jul 2010 at 11:23

GoogleCodeExporter commented 9 years ago
This would be fantastic!

Original comment by timm.sto...@gmail.com on 4 Feb 2012 at 3:37

GoogleCodeExporter commented 9 years ago
you can use a simple workaround for this .
Set a global variable like var plugin_active=0; 
When you need to disable the functions just set the variable to 
1(plugin_active=1;).
Modify the following functions ( mousedown,mousemove,mouseout,mouseup,dblclick 
) by capturing  the content in a if condition .
When the variable is set to 1 you will have the default behavior ...when 0 the 
mouse events will be captured by the plugin .
For eg ...after the changes mousedown will look like :
this.i.mousedown(function(e){
                    if(Gl_edit_progress<1){
                        self.startgrab();
                        this.xp = e.pageX;
                        this.yp = e.pageY;
                        return false;
                        }
                })

Works fine to me !

Original comment by rabaea.m...@gmail.com on 8 Mar 2012 at 9:29

GoogleCodeExporter commented 9 years ago
ERROR ...sorry i just copy pasted from my code and did not check it .
If it helps you have attached my version of code ...note that in the file the 
global variable is Gl_edit_progress and is not declared in that file ...you 
must add it at the top (var Gl_edit_progress=0;) .The use a button to trigger a 
function that will just set the Gl_edit_progress to 0 or 1 .
this.i.mousedown(function(e){
                    if(plugin_active<1){
                        self.startgrab();
                        this.xp = e.pageX;
                        this.yp = e.pageY;
                        return false;
                        }
                })

Works fine to me !

Original comment by rabaea.m...@gmail.com on 8 Mar 2012 at 9:34

Attachments: