If you want some parts of your blog page to attract the attention of readers, you can shake these parts, such as advertisements. Today this article will introduce how to shake the elements on your page. To achieve this goal, we need to use Jquery and JqueryUI. First let me create a vibration block ,... syntaxHighlighter. all (); if you want to draw attention from some parts of your blog page, you can shake these parts, such as advertisements, this article describes how to shake the elements on your page. To achieve this goal, we need to use Jquery and Jquery UI. First, let me create a vibration block, which can be an image or a common dom element, such as div and span. Name the element id as shake, which can be any name here. We use the image below: [html] Jquery UI does not have a ready-made method to shake elements. We need to use the effect method. The syntax is as follows: [javascript] effect ('shake ', options, speed); Parameter options (here there are three parameters): times: specify the number of element vibrations distance: Specify the vibration amplitude of the element ction: Specify the direction of the element vibrations. The specific implementation method is as follows, set three vibrations and call one vibration every MS: [javascript] function interval () {$ ('# shake '). effect ('shake ', {times: 3}, 100) ;}$ (document ). ready (function () {var shake = setInterval (interval, 500) ;}); before that, introduce Jquery and Jquery UI [html]
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.