Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

js / jquery slide bar

Featured Replies

Hi guys,

 

I am using a query slide bar in a site I am working on. I am able to make the bar slide up and appear by using a click function. However I can not figure out how to make it click and disappear? To be honest I do not even know if I am doing it the right way? it has been more of a trail and error thing for me.

 

So below is the script:

 

$(document).ready(function(){

//To switch directions up/down and left/right just place a "-" in front of the top/left attribute

 

//Caption Sliding (Partially Hidden to Visible)

$('.boxgrid.captionMain').click(function(){

$(".cover", this).stop().animate({top:'280px'},{queue:false,du ration:750});

}, function() {

$(".cover", this).stop().animate({top:'530px'},{queue:false,du ration:750});

});

});

 

note: If I change the .click function to hover, it goes up and down perfectly. I just want it to go up down with a click instead of a hover.

 

Thanks in advance

Hi guys,

 

I am using a query slide bar in a site I am working on. I am able to make the bar slide up and appear by using a click function. However I can not figure out how to make it click and disappear? To be honest I do not even know if I am doing it the right way? it has been more of a trail and error thing for me.

 

So below is the script:

 

$(document).ready(function(){

//To switch directions up/down and left/right just place a "-" in front of the top/left attribute

 

//Caption Sliding (Partially Hidden to Visible)

$('.boxgrid.captionMain').click(function(){

$(".cover", this).stop().animate({top:'280px'},{queue:false,du ration:750});

}, function() {

$(".cover", this).stop().animate({top:'530px'},{queue:false,du ration:750});

});

});

 

note: If I change the .click function to hover, it goes up and down perfectly. I just want it to go up down with a click instead of a hover.

 

Thanks in advance

 

 

probably make your life easyer to use the jquery functions hide and show if you actually want to make it visible/hidden, these can be customised too, in your customisations i'd recomment you animate based on padding or margin instead of top. :)

 

also when doing these sorts you tend to replace the control on animation...

 

try summin like this if you wish to carry on with same method...;

 

$('.boxgrid.captionMain').click(
   function()
   {
       if(this.hasClass("open")){
           //close
           $(".cover", this).stop().animate({top:'280px'},{queue:false,du ration:750});
       }else {
           //open
           $(".cover", this).stop().animate({top:'530px'},{queue:false,du ration:750});
       }
       thsi.toggleClass("open");
   )};
});

Edited by mikejonesey

  • Author

probably make your life easyer to use the jquery functions hide and show if you actually want to make it visible/hidden, these can be customised too, in your customisations i'd recomment you animate based on padding or margin instead of top. :)

 

also when doing these sorts you tend to replace the control on animation...

 

try summin like this if you wish to carry on with same method...;

 

$('.boxgrid.captionMain').click(
   function()
   {
       if(this.hasClass("open")){
           //close
           $(".cover", this).stop().animate({top:'280px'},{queue:false,du ration:750});
       }else {
           //open
           $(".cover", this).stop().animate({top:'530px'},{queue:false,du ration:750});
       }
       thsi.toggleClass("open");
   )};
});

 

Thanks for your reply, I did try your suggestion however, the slider now does not seem to move at all now. any other suggestions?

Thanks for your reply, I did try your suggestion however, the slider now does not seem to move at all now. any other suggestions?

 

Looks like he made a little typo in that code.

thsi.toggleClass("open");

Should be:

this.toggleClass("open");

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.