How can I customize Summernote text editor width? - summernote

Now I am using Summernote text editor. It is so easy and customizable. But I want to customize width. Example:
$("#editor").summernote({
'width':200px,
});
Above code is not effect. How can I do it?

you can use width like below.
$('.editor').summernote({
width: 150, //don't use px
});

For me it helped to wrap editor with another div with style
<div style="width: 80%;">

Related

Ckeditor - shared toolbar does not work

I am using the shared spaces plugin with Ckeditor to load a shared toolbar for multiple ckeditors but it still loads individual toolbar for all editors.
Here is a fiddle with the code that I am using: https://jsfiddle.net/7Lrcup3L/
HTML:
<div id="topSpace"></div>
<textarea id="editor1" name="editor1"></textarea>
<textarea id="editor2" name="editor2"></textarea>
<div id="bottomSpace"></div>
JS:
CKEDITOR.replace('editor1',{
sharedSpaces: {
top: 'topSpace',
bottom: 'bottomSpace'
}
})
CKEDITOR.replace('editor2',{
sharedSpaces: {
top: 'topSpace',
bottom: 'bottomSpace'
}
})
Need help with the same!
Shared Space is an optional plugin that is not included in the Standard preset. You should add it to your build first and/or enable with config.extraPlugins.
Check the source code of the Shared Toolbar and Bottom Bar SDK sample - just scroll down to the "Get Sample Source Code" to see a working sample for classic and inline editors.

How do I Change window size on kendo grid editor template?

I have a editor template for my kendo grid defined as
<script id="my-editor-template" type="text/x-kendo-template">
<div class="k-edit-label">
<label for="ContactName">Contact</label>
</div>
<div data-container-for="ContactName" class="k-edit-field">
<input type="text" class="k-input k-textbox" name="ContactName" data-bind="value:ContactName">
</div>
<!-- more fields, etc -->
</script>
In my grid definition, I definte editable like this:
editable =
{
mode: 'popup',
template: kendo.template($('#my-editor-template').html()),
confirmation: 'Are you sure you want to delete rec'
};
But I would like to make the popup window wider. I tried wrapping the contents of my template in a
<div style="width: 800px;"></div>
but the popup window stayed the same with, and made the contents scrollable (i.e., 800px content inside a 400px window).
I know I can do a
$(".k-edit-form-container").parent().width(800).data("kendoWindow").center();
after the window is opened, but all the content of the window is formatted for like 400px, and it feels a little hackish. Is there not a way I can dictate teh size in the template markup?
Kendo grid popup window is using kendo window, so you can set the height and width like this
editable: {
mode: "popup",
window: {
title: "My Custom Title",
animation: false,
width: "600px",
height: "300px",
}
}
Here is dojo for you, but since i did not define a custom template it still use default one so as the result the window size already 600 x 300 but the content is not.
After an hour+ long research following code fixed my issue. I had to put this code in the edit event.
$(".k-edit-form-container").attr('style', "width:auto");

Fotorama - change cursor to custom image of arrow, previous and next

I am trying to change the cursor to a custom image of a "previous" and "next" arrow via CSS but am not having any luck.
I would like for the cursor to change to a left arrow when hovering on the left side, and to a right arrow when hovering on the ride side.
It seems that something is overriding my CSS when I add it in the stylesheet.
.leftarrow:hover {cursor: url(leftarrow.png), auto;}
.rightarrow:hover {cursor: url(rightarrow.png), auto;}
Is this possible to do via CSS, or do I need some JS for this?
Thanks
Why css?
you can change it in plugin options ;)
$('#fotorama').fotorama({
arrowPrev: '<img src="/path-to-image/Previous.png" width="30" height="30" >',
arrowNext: '<img src="/path-to-image/Next.png" width="30" height="30" >'
});

Set kendo ui dropdownlist width

I would like to use a kendo drop-down list, which has a fixed size since is constrained by other fields in the page, but when it shows the drop-down items of the list, the drop-down area should resize to the maximum length of the items. Sort of fixed width for the item displayed, but auto width for the drop down list.
Something like
|my choice | <-- fixed width displayed on the page
|next choice |
|previous choice | <-- dropdown area to select another item
|dummy |
Is this possible through CSS or drop-down list properties set through jQuery?
You can set the width of a DropDown List both using a CSS or using a method.
If the id of you DropDownList is my-dropdown then you should write:
Using CSS
#my-dropdown-list {
width: auto !important;
}
NOTE: We have appended -list to the original id. The "!important" is important since you want to overwrite original width definition.
Using a method
$("#my-dropdown").data("kendoDropDownList").list.width("auto");
In addition to use "auto" for getting the width automatically adjusted to the text, you can use a fixed width:
#my-dropdown-list {
width: 300px !important;
}
or:
$("#my-dropdown").data("kendoDropDownList").list.width(300);
The above answer didn't work for me. I have a the advantage of knowing that my dropdown is inside of a div.
<div class="myDivClass">
<select id="myDropDown"><option>First</option><option>Second></option></select>
<!--... other stuff in the div-->
<div>
I found that the span has the class k-dropdown so I added the CSS
.myDivClass span.k-dropdown {
width: 300px
}
What worked for me is to render an extra class on the base element:
<input .. class="ExtraLarge ..
Which produced:
<span style="" class="k-widget k-dropdown k-header ExtraLarge" ..
With this ExtraLarge class in place, this worked great in FireFox and Chrome:
span.k-dropdown.ExtraLarge
{
width:400px;
}
Using the following code to be the template of the kendo dropdownlist:
<div class="myDivClass">
<select id="myDropDown"><option>First</option><option>Second></option></select>
<!--... other stuff in the div-->
<div>
you will initiate the kendoDropDownList using jQuery as follows:
$("#myDropDown").kendoDropDownList().data("kendoDropDownList");
Now, to set this controller to take up the full width, what you have to do, is to set the width of the select element to 100%, or whatever is your desire.
e.g.:
<select id="myDropDown" style="width: 100%"><option>First</option><option>Second></option></select>
OR, is a css file:
#myDropDown { width: 100% }
If the id of you DropDownList is my-dropdown then you should write:
#my-dropdown-list {
width: auto !important;
-moz-min-width: 120px;
-ms-min-width: 120px;
-o-min-width: 120px;
-webkit-min-width: 120px;
min-width: 120px;
/*max-width: 210px;*/
}
Read the explanation below.
http://docs.telerik.com/kendo-ui/controls/editors/dropdownlist/how-to/auto-adjust-the-width

onload image go from 0 width to 100px width with easing

I need to "slide in" a (background-)image in a div.
When I load the page, some div with a bg image or image inside it (and overflow?) needs to go from invisible/width=0 to 100px width. This needs to ease in.
Can anyone please help me out with the js?
<div style="overflow:hidden; width:100px; height:40px;">
<img src="someimg.png" height="40" width="100" />
</div>
This uses jquery on document ready.. For easing can use the standard jquery 'linear' but I included the jquery.easing plugin where you can have different easing options.
http://jsfiddle.net/DyW7M/1/
$(document).ready(function () {
$('#makeitlong').animate({ width: '400'}, 2000, 'linear');
});​

Resources