Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am having a CSS newb problem. We are still using the old YUI2 which I am using to create sub-tables within a table as in this:
When the sub table is shown YUI extands the height of the row and adds a white div as you can see. I would like to add some style to that div (behind the subtable).
I CAN assign an id to that div by overriding the class and modifying the table's functionality in order to get this:
I would really rather not go this route. I would prefer to just target the div with CSS but my inexpereince has trumped me. When I inspect the div google gives me this:
How do I target the highlighted div? This seems like it should be easy as I can see right there what classes the div has but I just can't get it.
EDIT
Not sure if this will help but my javascript uses the following function to create the subtable:
DMAS.deviceconsole.datamonitor.DataMonitorOverviewTable.prototype.secondSubTable = function(state){
var json = {
"Fruit":[
{"name":"apples","type":"fruit", "color":"red"},
{"name":"broccoli","type":"veg","color":"red"},
{"name":"cherriess","type":"fruit","color":"red"}
]
};
var dsLocalJSON2 = new YAHOO.util.DataSource(json);
dsLocalJSON2.responseType = YAHOO.util.DataSource.TYPE_JSON;
dsLocalJSON2.responseSchema = {
resultsList : "Fruit",
fields : ["name","type","color"]
};
var fruitDT = new REDT(
state.expLinerEl,
[
{key:'name', label:'Name', sortable:true},
{key:'type', label:'Type', sortable:true},
{key:'color', label:'Color', sortable:true}
],
dsLocalJSON2,
{
className : "dataMonitorSubtable"
}
);
// Store the reference to this datatable object for any further use
// (specially destroying it, as above)
this.setExpansionState(state.record,NESTED_DT,fruitDT);
//Subscribe to the rowExpansionDestroyEvent so I can destroy the tracksDT table
// before its container (the album row) is gone and it ends a zombie
fruitDT.on(this,'rowExpansionDestroyEvent', function (state) {
state[NESTED_DT].destroy();
});
}
Here is a snippet from the YUI Library where it expands the row
expandRow : function( recordId ){
var state = this.getExpansionState( recordId );
if( !state.expanded){
this.setExpansionState( recordId, 'expanded', true );
var expTrEl = state.expTrEl,
record = state.record,
trEl = this.getTrEl( record );
if (expTrEl) {
Dom.insertAfter(state.expTrEl,this.getTrEl(recordId));
Dom.setStyle(state.expTrEl,'display','');
} else {
expTrEl = document.createElement('tr');
var expTdEl = document.createElement( 'td' ),
expLinerEl = document.createElement( 'div' ),
template = this.get(TEMPLATE);
Dom.addClass(expTrEl, CLASS_EXPANSION);
expTdEl.colSpan = this.getFirstTrEl().childNodes.length;
Dom.addClass(expLinerEl, CLASS_LINER);
expTrEl.appendChild( expTdEl );
expTdEl.appendChild( expLinerEl);
this.setExpansionState( recordId, 'expTrEl', expTrEl);
this.setExpansionState( recordId, 'expLinerEl', expLinerEl);
// refresh the copy of the expansion state
state = this.getExpansionState(recordId);
if( Lang.isString( template ) ){
expLinerEl.innerHTML = Lang.substitute( template, record.getData() );
} else if( Lang.isFunction( template ) ) {
template.call(this, state );
} else {
return false;
}
}
//Insert new row
Dom.insertAfter( expTrEl, trEl );
Dom.replaceClass( trEl, CLASS_COLLAPSED, CLASS_EXPANDED );
/**
* Fires when a row is expanded
*
* #event rowExpandedEvent
* #param state {Object} see getExpansionState
*/
this.fireEvent( "rowExpandedEvent", state);
return true;
}
},
You can try something like this:
div.dataMonitorSubtable.yui-dt {
background-color: red;
}
Related
I'm working on my WordPress website with Visual Composer.
I need to include a pageable container but it would be great if it can be like a slideshow.
This is my pageable container
Thanks in advance,
Regards :)
Based upon the current version of WP Bakery Page Builder the below works for me:
To build it I created a row with 3 columns, with the pageable container in the middle column and the left and right arrow images in the columns on either side.
Both arrow images and the pageable container were given IDs. In my example the IDs of the arrows were #arrow_prev and #arrow_next respectively. You can give your pageable container any unique ID.
(function ($) {
$(document).ready(function(){
$( '#arrow_prev' ).click( function( e ) {
var pageable_container = $(this).closest(".vc_row").find(".vc_tta-panels-container");
move_pageable_container(pageable_container,'prev');
});
$( '#arrow_next' ).click( function( e ) {
var pageable_container = $(this).closest(".vc_row").find(".vc_tta-panels-container");
move_pageable_container(pageable_container,'next');
});
function move_pageable_container(pageable_container,direction){
// Make a list of the panel IDs
var panel_ids = $(pageable_container.find(".vc_tta-panel"))
.map(function() { return this.id; }) // convert to set of IDs
.get();
// Find position of the active panel in list
var current_active_pos = panel_ids.indexOf($(pageable_container).find(".vc_tta-panel.vc_active").attr('id'));
var new_pos = 0;
switch(direction) {
case 'prev':
if (current_active_pos > 0){
new_pos = current_active_pos-1;
}else{
new_pos = panel_ids.length-1;
}
break;
case 'next':
if (current_active_pos < panel_ids.length-1){
new_pos = current_active_pos+1;
}else{
new_pos = 0;
}
break;
}
// Clear active panels
$(pageable_container.find(".vc_tta-panel")).each(function(i,a) {
$(this).removeClass("vc_active");
});
var new_active_panel = $(pageable_container).find('#'+ panel_ids[new_pos]);
$(new_active_panel).addClass("vc_animating");
$(new_active_panel).addClass("vc_active");
setTimeout(
function(){
$(new_active_panel).removeClass("vc_animating");
}, 350);
}
}
);
})(jQuery);
If you want a pseudo fading-in effect then you can use this additional CSS in your style sheet:
#id_of_pageable_container .vc_tta-panel.vc_animating {
opacity: 0!important;
}
Where #id_of_pageable_container is the ID that you gave your pageable container
A simpler solution with vanilla js only:
The idea is to find the target page button and press it programmatically, so that there is no need to mimic the plugin's animations as in Chaz's solution.
Add js (via Raw JS widget / other means):
function prevSlide () {
const slides = document.getElementsByClassName('vc_pagination-item');
for (let i = 0; i < slides.length; i++) {
if (slides[i].className.includes('vc_active')) {
if (i - 1 < 0) return;
slides[i - 1].firstChild.click();
return;
}
}
}
function nextSlide () {
const slides = document.getElementsByClassName('vc_pagination-item');
for (let i = 0; i < slides.length; i++) {
if (slides[i].className.includes('vc_active')) {
if (i + 1 >= slides.length) return;
slides[i + 1].firstChild.click();
return;
}
}
}
Add button widgets and set href to call js:
For left arrow button,
javascript:prevSlide();
For right arrow button,
javascript:nextSlide();
Hope this helps.
I prefer to use the Post Grid widget for that. Keep in mind that the pageable container is not totally responsive, it doesn't react to swipe touching, but the Post Grid does.
Post Grid is really powerful, although it also has its caveouts. You can create your content with posts and pages, or a custom post type and then filter what you want to show in your slider from the widget options.
In "advanced mode" you can use the Grid Builder to create your own template and control the output.
The only problems that I've found with this method is to set a variable height in sliders and that sometimes it is slow loading content and is not possible to do a lazyload.
I have a funny trouble with CKEditor, it's described as below:
In CKEditor, I create a headline, an iframe or insert an image. It creates a "BORDER" around the content of the headline, iframe or image.
Now, I scroll the wheel of mouse up or down out of editor area, the "BORDER" still appears as below:
How I can remove this "BORDER"?
Please help me.
Thank in advance,
Vu
What you are seeing is IE native feature. Images, floated divs etc. get these resize borders.
IIRC any element which has hasLayout property will gain these resize handles.
In IE 8-10 there is possibility to block object resizing with - disableObjectResizing.
Unfortunately IE11 doesn't provide any handles to work around this problem. This is IE11 bug. There is a hack for IE11 which was not included into core code - https://dev.ckeditor.com/ticket/9317#comment:16.
Depending on method used for creating CKEditor, this hack can be for example implemented as follows:
If classic editor and replace method is used -
var editor = CKEDITOR.replace( 'editor1', {});
editor.on( 'pluginsLoaded', function( evt ){
editor.on( 'contentDom', function( e ){
var editable = editor.editable(),
element = editable.$;
if ( element.addEventListener ) {
// IE up to 10.
element.addEventListener( 'mscontrolselect', function( evt ) {
evt.preventDefault();
} );
} else {
// IE11 and higher.
element.attachEvent( 'oncontrolselect', function( evt ) {
evt.returnValue = false;
} );
}
});
});
If classic or inline editors are created automatically -
CKEDITOR.on( 'instanceCreated', function( event ) {
var editor = event.editor;
editor.on( 'contentDom', function( e ){
var editable = editor.editable(),
element = editable.$;
if ( element.addEventListener ) {
// IE up to 10.
element.addEventListener( 'mscontrolselect', function( evt ) {
evt.preventDefault();
} );
} else {
// IE11 and higher.
element.attachEvent( 'oncontrolselect', function( evt ) {
evt.returnValue = false;
} );
}
});
});
NOTE: Please also have a look at https://dev.ckeditor.com/ticket/9317#comment:26. There are other scenarios where resizing might get broken. It would be good to check if this hack works for all of them.
Part of the program I am creating includes having a drop down menu where the user can select a type of load, before inputting the position of the load. The load and position would then appear in a datagrid and as many as the user pleases can be added.
I am not very sure where I went wrong but this is my code:
function loadlist():void{
combobox1.addItem ( { label: "Choose a Load" } );
combobox1.addItem ( { label: "Point Load" } );
combobox1.addItem ( { label: "Bending Moment" } );
combobox1.addItem ( { label: "Uniformly Distributed Load" } );
combobox1.addItem ( { label: "Varying Distributed Load" } );
combobox1.addItem ( { label: "Nonlinear Distributed Load" } );
}
function loadbuttonclick (event:MouseEvent):void{
combobox1.removeAll();
loadlist();
trace("load");
//datagrid
var myTextFormat: TextFormat = new TextFormat();
myTextFormat.font = "Comic Sans MS";
var datagrid:DataGrid = new DataGrid;
datagrid.columns = ["Type of Load", "Position of Load"];
datagrid.resizableColumns = true;
datagrid.setRendererStyle("textFormat", myTextFormat);
datagrid.addItem(Load type: "combobox1.selectedItem.label", Load position: "loadposition.text");
addChild(datagrid);
datagrid.addEventListener(Event.CHANGE, gridItemClick);
function gridItemClick (event:Event):void{
trace("The Selected Load is " + combobox1.selectedItem.label);
}
}
}
You should be getting an error from this line, the syntax seems to be wrong:
datagrid.addItem(Load type: "combobox1.selectedItem.label", Load position: "loadposition.text");
It's not an object, an object has to defined with curly brackets {}.
Object keys can't have spaces when defined using curly brackets.
You're trying to pass dynamic values as strings, you should write combobox1.selectedItem.label instead of "combobox1.selectedItem.label".
It's been a while wince I've worked with datagrids, but if I recall correctly, the item is an object, which keys should match the columns.
Since your columns include spaces you wouldn't be able to write:
datagrid.addItem({Load type: combobox1.selectedItem.label, Load position: loadposition.text});
However, this should work:
var object:Object = new Object();
object["Type of Load"] = combobox1.selectedItem.label;
object["Position of Load"] = loadposition.text;
datagrid.addItem(object);
I didn't have the time to test it, but that should be the right direction.
I am finally reaching out for help. I've been trying to get a no results message to show up on my Isotope image gallery for a week now, with only a little bit of luck. I had an example working at one point, but the message wouldn't hide until the animation was complete, so it didn't look good at all.
Surely someone has a solution.
I would greatly appreciate it if someone is able to help me. I have test site that I will link here in just a second.
For now here is the first half of my isotope configuration file. I have the '.message-div' placed at the bottom of my #isotopegallery div with css applying 'display: none;.'
jQuery(window).load(function() {
var $container = $('#isotopegallery').imagesLoaded(function() {
$container.isotope({
itemSelector: '.photo',
masonry: {
columnWidth: 161,
gutter: 10
},
transitionDuration: '0.6s'
});
// Filters
//
var filters = {};
$('#isotopefilters').on('click', '.menu-item', function() {
var $this = $(this);
// get group key
var $buttonGroup = $this.parents('.filter-title');
var filterGroup = $buttonGroup.attr('data-filter-group');
// set filter for group
filters[filterGroup] = $this.attr('data-filter');
// combine filters
var filterValue = '';
for (var prop in filters) {
filterValue += filters[prop];
}
$container.isotope({filter: filterValue});
// Possibility
$container.isotope( 'on', 'layoutComplete',
function( iso, laidOutItems ) {
if ( laidOutItems < 1 ) {
$('.message-div').fadeIn('slow');
} else {
$('.message-div').fadeOut('fast');
}
})
});
});
});
There is an easy workaround to achieve the "no result" message.
Consider ".photo" as class for the itemSelector. As isotope is simply attaching ".isotope-hidden" to the div-container if it does not match the filter, the number of these divs equals the total of all isotope items in case of "no result". Easy:
if($(".isotope-hidden").length == $(".photo").length) {
$("#mynoresults").show();
}
I am trying to display some aggregate value (like total) in the last row of an ng-grid. The style and css class of the last row needs to be different than the other cells in that column. How to acheive this?
The cellTemplate in a column definition applies to all cells in that column, but in my case I need to have a different style for the last row in that column. Can anyone please suggest me a solution.
Thanks
Sudipta
I was able to add a class to the last row through a plugin:
function ngGridAddClassToLastRow(className) {
var self = this;
self.grid = null;
self.scope = null;
self.init = function (scope, grid, services) {
self.domUtilityService = services.DomUtilityService;
self.grid = grid;
self.scope = scope;
var addClass = function () {
var lastRow = self.scope.renderedRows[self.scope.renderedRows.length - 1];
lastRow.elm[0].className = lastRow.elm[0].className + ' ' + className;
};
self.scope.$watch(grid.config.data, addClass);
};
}
And with this added to the gridOptions:
...
plugins: [new ngGridAddClassToLastRow('<some class name>'),
...
And of course add some css, e.g. in my case:
.lastRow {
border-bottom: 0px;
}
That worked for me. I cannot say for certain that is the way to go since, needless to say, i'm a noob with Angular and ngGrid. I've constructed the plugin from flexible height plugin.
You can set a special property "isLast" (or however you like to name it) of the item that should be displayed in the last row. This item can be accessed through row.entity.isLast.
... somewhere in your controller ....
$scope.getRowClass = function(row) {
return row.entity.isLast === true ? 'lastRow' : '';
}
... somewhere inside the gridOptions ...
rowTemplate: '<div ng-style="{ \'cursor\': row.cursor }" ng-repeat="col in renderedColumns" ng-class="[col.colIndex(), getRowClass(row)]" class="ngCell {{col.cellClass}}">....</div>'
Based on the .lastRow class you could define a custom style for the last grid row.