collapse

Bootstrap collapse - go to top of the open item?

六月ゝ 毕业季﹏ 提交于 2019-12-02 19:28:29
I'm using the bootstrap collapse function, but when I open an element which has a lot of content, then open the next element, it jumps down and doesn't go to the top of the open element. I've tried using scrollto plugin as shown below but it doesn't work: JS: $(function(){ $('a.accordion-toggle').click(function(){ $.scrollTo( this, 500); }) }); HTML: <div class="accordion" id="accordion2"> <div class="accordion-group heading-left-11"> <h5 class="accordion-heading row"> <a class="accordion-toggle span11" data-toggle="collapse" data-parent="#accordion2" href="#collapse1">Austria</a> <div class=

How to open and collapse the same JQuery accordion with click on it only

血红的双手。 提交于 2019-12-02 04:48:57
Trying to get the accordion open and collapse only when it's being clicked. I am able to open/collapse it but it is getting closed also when another accordion is clicked. It should open or close on its own - independently from other accordions. This is what I have tried. JS: $(document).on("click", ".accordion-toggle", function () { if ($(this).attr('class').indexOf('open') == -1) $(this).toggleClass("open").next().slideToggle('fast'); //Hide the other panels $(".accordion-toggle").not($(this)).removeClass("open"); $(".accordion-content").not($(this).next()).slideUp('fast'); }); Fiddle: Demo I

bootstrap-collapse.js hide and show events

元气小坏坏 提交于 2019-12-01 20:43:44
I'm having a problem with boostrap-collapse.js show.bs.collapse and hide.bs.collapse events - those events do not fire up when invoked for the first time (e.g. page loads -> on.show = event is not fired -> on.hide = event is not fired -> on.show = event is fired) . After showing / un-hiding the element those events get fired up as intended. HTML <div class = "student" id = "stud1" onclick = "return expandTable(this,'stud1exp')"> // header and stuff </div> <div class="panel-collapse collapse" id = "stud1exp"> // info that I want to show/hide </div> JS function expandTable(self,invoke){ $("#"

What code do i need to collapse a div when another is open?

安稳与你 提交于 2019-12-01 20:29:16
i use a simple bit of code to make a div collapse, this is it: <script language="JavaScript"> <!-- function expand(param) { param.style.display=(param.style.display=="none")?"":"none"; } //--> </script> what code do i add to make it recognise when one div is open an collapse the previous div? here's the link I'd use: <a href="javascript:expand(document.getElementById('div1'))">Link 1</a> <div id="div1" width="300px" style="display:none"></div> Any ideas? If you were willing to use jQuery, the selector of your interest is something along the lines of $('div#parent-container > div').filter('

Including all permutations when using data.table[,,by=…]

前提是你 提交于 2019-12-01 17:36:14
问题 I have a large data.table that I am collapsing to the month level using ,by . There are 5 by vars, with # of levels: c(4,3,106,3,1380) . The 106 is months, the 1380 is a geographic unit. As in turns out there are some 0's, in that some cells have no values. by drops these, but I'd like it to keep them. Reproducible example: require(data.table) set.seed(1) n <- 1000 s <- function(n,l=5) sample(letters[seq(l)],n,replace=TRUE) dat <- data.table( x=runif(n), g1=s(n), g2=s(n), g3=s(n,25) )

Bootstrap 4 nested collapse “data-parent” not working

三世轮回 提交于 2019-12-01 08:21:20
I want to use collapse data-parent options . I need traditional accordion behavior: all collapsible elements under the specified parent should be closed when a collapsible item is shown. But it doesn't work. I don't know if that's because of my nested collapse or I do something wrong. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384

How to detect expanding of status bar?

▼魔方 西西 提交于 2019-12-01 04:09:34
My application allows launching of other application from mine. None of my activity shows Status Bar.But when launching other applications like Camera the user can access the status bar .So i tried the following code snippet for collapsing the Status Bar inside a service(So it collapse every time and code running always). int currentapiVersion = android.os.Build.VERSION.SDK_INT; Object service = getSystemService("statusbar"); Class<?> statusbarManager = Class.forName("android.app.StatusBarManager"); Method collapse = null; if(currentapiVersion <= 16){ collapse = statusbarManager.getMethod(

Javascript toggle with Bootstrap collapse plugin

点点圈 提交于 2019-12-01 03:27:35
I try to use the toggle function of the Bootstrap collapse plugin programmatically. I manage to toggle a div when I click on the link in accordion-heading but it works only once, that is to say I cannot click again to hide the div. Here is my code : <div id="accordion" class="accordion"> <div class="accordion-group"> <div class="accordion-heading"> <a id="program${bean.id}" data-parent="#accordion" class="accordion-toggle"> ... </a> </div> <div id="collapse${bean.id}" class="accordion-body collapse"> <div class="accordion-inner"> ... </div> </div> </div> And later in the JSP : $.each($('

How to detect expanding of status bar?

喜夏-厌秋 提交于 2019-12-01 02:05:56
问题 My application allows launching of other application from mine. None of my activity shows Status Bar.But when launching other applications like Camera the user can access the status bar .So i tried the following code snippet for collapsing the Status Bar inside a service(So it collapse every time and code running always). int currentapiVersion = android.os.Build.VERSION.SDK_INT; Object service = getSystemService("statusbar"); Class<?> statusbarManager = Class.forName("android.app

Collapse sequential numbers to ranges in bash

只愿长相守 提交于 2019-11-30 22:01:39
I am trying to collapse sequential numbers to ranges in bash. For example, if my input file is 1 2 3 4 15 16 17 18 22 23 45 46 47 I want the output as: 1 4 15 18 22 23 45 47 How can I do this with awk or sed in a single line command? Thanks for any help! $ awk 'NR==1{first=$1;last=$1;next} $1 == last+1 {last=$1;next} {print first,last;first=$1;last=first} END{print first,last}' file 1 4 15 18 22 23 45 47 Explanation NR==1{first=$1;last=$1;next} On the first line, initialize the variables first and last and skip to next line. $1 == last+1 {last=$1;next} If this line continues in the sequence