Jump to content

How can i make my navbar become default no animations js when small device


dauruk0512

Recommended Posts

i was searching about it and tested and i get nothing progress, i have been not upload to server my project so i dont have any demo to show, but here is my issue https://github.com/rabmyself/smint/issues/21

 

i use jquery sminth yes everything is working and love itthe plugin, but i face problem about it when it in small device!

 

here is setting for sminth

$('.subMenu').smint({         'scrollSpeed' : 1000    });

and i have try to remove with use this function

 $(window).on('resize', function(){      var win = $(this); if (win.width() < 514) {       // alert('handphone');        $("nav").removeClass("subMenu");    //$('nav').attr('style','');   } });
yes the class removed but the navbar has css when i firebug so they all cannot remove all,
i have logic that to remove but don't know to write in jquery even give me errors, here is my logic how can i do that in my jquery!
$(window).on('resize', function(){var win = $(this);  if (win.width() < 514) {//navbar without effect scroll     } else{//navbar witheffect scroll});

Thanks

Link to comment
Share on other sites

You would need to figure out what event handlers are being added to the element and removing them. Many jQuery libraries have a specific function to remove things, but it looks like the developer of this one didn't add that functionality, so you'll have to manually go through his source code and find where the event handlers are being bound.

 

Alternatively, you can use Javascript to detect the width of the page first and then only call the smint() method if the screen is wide enough.

Link to comment
Share on other sites

Sorry i edit my answer, after read you answer here, can you give me little guide code about it,

 

 

 

Alternatively, you can use Javascript to detect the width of the page first and then only call the smint() method if the screen is wide enough.

 

 

i'm not asking to code i know the logic but this time i'm new bie at full jquery, Thanks for any repsond

 

 

Freddy

Edited by dauruk0512
Link to comment
Share on other sites

The elements you need to make this happen are all there in your first post.

 

It won't work on the resize event, but if the screen starts off small, the function won't be used. This script should only be called once when the page loads.

if ($(window).width() > 514) {  $('.subMenu').smint({    'scrollSpeed' : 1000  });} 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...