Douban jquery Code Instance _jquery

Source: Internet
Author: User
The method to execute after the document is loaded (see jquery documentation)
Generally, when a document is loaded, all events should be bound, except in one case.
For example, the content that is retrieved from the Ajax method contains the action button, which is required to perform the binding for this part of the function.
Copy Code code as follows:

A manual call to Load_event_monitor (element) is required; Method.
$ (function () {
Load_event_monitor (document);
});
Note that the O object here is an HTML element rather than a jquery object, so you should use the $ (O) function when calling its method
Turn it into a jquery object.
Bowtech.init_forder = function (o) {
var Eid = $ (o). attr ("id"). Split ("-") [1];
var fo = $ ("#f-" +eid);
var unfo = $ ("#unf-" +eid);

Fo.click (function () {
$ (O). Hide ();
Unfo.show ();
Fo.hide ();
});
Unfo.click (function () {
$ (O). Show ();
Fo.show ();
Unfo.hide ();
});
}


JQuery.fn.extend ({
Set_caret:function () {
if (!$.browser.msie) return;
var initsetcaret = function () {This.caretpos = Document.selection.createRange (). duplicate ()};
This.click (Initsetcaret). Select (Initsetcaret). KeyUp (Initsetcaret);
},
Insert_caret:function (Textfeildvalue) {
var textobj = this[0];
if (document.all && textobj.createtextrange && textobj.caretpos) {
var Caretpos=textobj.caretpos;
Caretpos.text = caretPos.text.charAt (caretpos.text.length-1) = = "? Textfeildvalue+ ": textfeildvalue;
else if (Textobj.setselectionrange) {
var Rangestart=textobj.selectionstart;
var rangeend=textobj.selectionend;
var tempstr1=textobj.value.substring (0,rangestart);
var tempstr2=textobj.value.substring (rangeend);
TEXTOBJ.VALUE=TEMPSTR1+TEXTFEILDVALUE+TEMPSTR2;
Textobj.focus ();
var len=textfeildvalue.length;
Textobj.setselectionrange (Rangestart+len,rangestart+len);
Textobj.blur ();
} else {
Textobj.value+=textfeildvalue;
}
}
})

It's easier to use the front desk, just write this:

Copy Code code as follows:

<div id= "test2″class=" mod ">
Here you can put the title
<div class= "J Modb A_forder" id= "modb-1002″>
Here are some of the main elements
<dl>
<dt>hello world</dt>
<dd>
Hahaha</dd>
</dl>
This experiment was done on Sharjah's Shenzhou
</div>
<div class= "Edit" >
<a id= "f-1002″class=" Forder "href=" javascript:void (0); " >[]</a> <a id= "Unf-1002″
class= "Unforder" href= "javascript:void (0);" >[unfold]</a>
</div>
</div>

The style is omitted, everyone can write their own, and finally send two effect chart:

What it looks like when it's closed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.