Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match and unmatch a jQuery Plugin #22

Closed
mtsuwd opened this issue Nov 19, 2012 · 5 comments
Closed

Match and unmatch a jQuery Plugin #22

mtsuwd opened this issue Nov 19, 2012 · 5 comments

Comments

@mtsuwd
Copy link

mtsuwd commented Nov 19, 2012

Hallo,
i want to use a jQuery Plugin for the Desktop (min-width: 1024px) but not for mobile Devices (max-width: 1024px;) and when the client resize the Browser-window under 1024px width.

I try this, but it doesn´t work. How can i do this?

$(document).ready(function() {

enquire.register("screen and (min-width:1024px)", {

       match : function() {
        $('#fancy').fancybox({
            openEffect  : 'fade',
            closeEffect : 'fade',
            padding     : 40,
            helpers : { overlay : { css : { 'background' : 'rgba(25,25,25,0.9)'}}}  
        });         
        },
    unmatch : function() {
             $('#fancy').unbind(.fancybox(););
        },  
    setup : function() {},    
    deferSetup : true,          
    destroy : function() {}     
}).listen();

});

Thanks

@WickyNilliams
Copy link
Owner

Hey!

Could you create a reduced test case on jsfiddle so I can diagnose please? Also which browser(s) are you observing this issue?

Thanks

@mtsuwd
Copy link
Author

mtsuwd commented Nov 19, 2012

Here is the Link

http://jsfiddle.net/NwbmH/

@WickyNilliams
Copy link
Owner

Thanks for that. In the fiddle i can see that your code is not quite correct. In particular this line from your unmatch callback:

    $("#jmpress").remove(.jmpress);

.jmpress is not valid JS, it is not a valid identifier and will cause an exception. This is your problem here!

I had a quick look at the jmpress API and what you needed to do was call it's deinit method. You can see a working example here in this updated fiddle :) http://jsfiddle.net/NwbmH/1/

If this solves your problem let me know and i'll close this issue off

@mtsuwd
Copy link
Author

mtsuwd commented Nov 20, 2012

Thank you it´s works !

@WickyNilliams
Copy link
Owner

Sweet! Hopefully you understand the problem with your original code. Going to close this now :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants