Hello tdreyno, Thank you for answering my last problem.
Now I got problem to get click() method or any other of the jquery methods.
No one of the selectors I try doesen't work. Any idea for solution.
Can you add those methods to your plugin for flexibility.
Hello again :).
This morning I notice you update the plugin and I was very surprise about the good work you've done.
However I customize it a bit. Hope you won't be mad at me. So I will write you about those changes, if you like to include them to your plugin.
I like to pass all variables and customized function to the plugin. So I call the plugin in fallowing way:
$(':checkbox').iphoneStyle(
'click',
function(){ return confirm('change it ?'); },
{ checkedLabel: 'Very Long Text', uncheckedLabel: 'Tiny'} );
Тhis of course is not the necessary way of calling it. You can also call it like this.
$(':checkbox').iphoneStyle();
Or
$(':checkbox').iphoneStyle(
{ checkedLabel: 'Very Long Text', uncheckedLabel: 'Tiny'} );
Like you call $(".selector").bind('event',function(){}). But you got 1 additional variable :).
In the plugin source I add this param:
$.iphoneStyle = { ...... , defaultEvents: { click: 'click' }};
I also add:
$.fn.iphoneStyle = function(event, fn , options)
way of geting the variables. Notice "fn" he represent the custom function I wrote.
//decide which of the variables are undefined and which not.
Ok - It is working fine in Firefox by itself. However, if I implement it in Firefox with other CSS styles (that are not at the beginning of the document) it breaks. I think I am having an issue similar to the IE8 issue.
However, using Safari, it works fine.
Any ideas about what I can do or if there will be a fix coming along soon?
You want to track click events on the control? I suggest trying something like: $('.iPhoneCheckContainer').click() after the plugin has run.
Hello again :).
This morning I notice you update the plugin and I was very surprise about the good work you've done.
However I customize it a bit. Hope you won't be mad at me. So I will write you about those changes, if you like to include them to your plugin.
I like to pass all variables and customized function to the plugin. So I call the plugin in fallowing way:
$(':checkbox').iphoneStyle( 'click', function(){ return confirm('change it ?'); },
{ checkedLabel: 'Very Long Text', uncheckedLabel: 'Tiny'} );
Тhis of course is not the necessary way of calling it. You can also call it like this.
$(':checkbox').iphoneStyle();
Or
$(':checkbox').iphoneStyle( { checkedLabel: 'Very Long Text', uncheckedLabel: 'Tiny'} );
Like you call $(".selector").bind('event',function(){}). But you got 1 additional variable :).
In the plugin source I add this param:
$.iphoneStyle = { ...... , defaultEvents: { click: 'click' }}; I also add:
$.fn.iphoneStyle = function(event, fn , options)
way of geting the variables. Notice "fn" he represent the custom function I wrote.
//decide which of the variables are undefined and which not.
settings = $.extend({}, $.iphoneStyle.defaults, settings); I use settings instead of options...
Also customize the slide effect in order to dynamic binding of events :
// prepare default and passed events in suitable format
// attach events to iphoneStyle checkbox
I hope you like my modification and I will appreciate comment about them.
Sorry for my bad english.
Best Regards engineer Mihail Vladov
Mihail, customizing code is what GitHub is all about :)
You should "fork" my code, add your changes and that will allow me to see what you're doing. This article has some directions:
http://github.com/guides/fork-a-project-and-submit-your-modifications
The events callbacks are a very good idea.