Front-end special function integration

One: Get data in the background, after dynamically splicing pages through js, the processing of events in the spliced ​​pages.

1. The first way: use the <a> tag

<a href="链接" οnclick="事件([this])"> </a>

If there is a link, you can directly use the link to jump (parameters can be spelled). If the onclick event is triggered, user parameters cannot be used in the event, but this can be used. At certain moments, you can get objects through this and pass parameters. Finally, you can change the style of the <a> tag to make the page look more beautiful.

2. The second way: use class libraries for event binding.

    $('#id').on('click', function() {content});

This is more common, the use of JQuery.

3. The third way: attachEvent

document.getElementById("id").attachEvent("onclick", 事件名);

2: About content folding

<p>Tag setting attributes: css style detailed explanation

overflow:hidden; //多余文本隐藏
text-overflow:ellipsis;//多余文本显示省略号(网上有说可以使用字符的,我没尝试出来)
display:-webkit-box; 
-webkit-box-orient:vertical;
-webkit-line-clamp:2;

Three: About the function realization of [load more]: refer to js to realize the function example of "load more" 

 

 

Guess you like

Origin blog.csdn.net/FV8023/article/details/101374274