Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set Mouse Forbidden style with CSS () in jquery

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "jquery how to use CSS() to set mouse ban style", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "jquery how to use CSS() to set the mouse forbidden style"!

Method: Simply use CSS() to set the value of the mouse style property "cursor" to "not-allowed," with the syntax "element-object.css("cursor,""not-allowed")" or "element-object.css({"cursor":"not-allowed"})."

This tutorial operates on Windows 7, jquery version 1.10.2, Dell G3 computers.

To set the mouse suppression style, simply use the cursor property of.

Just use CSS() to set the value of the mouse style property "cursor" to "not-allowed."

There are two types of setup syntax:

Element Object.css("cursor","not-allowed") Element Object.css({"cursor":"not-allowed"})

Implementation example:

$(document).ready(function() { $("button").click(function() { // $("p").css("cursor","not-allowed"); $("p").css({"cursor":"not-allowed"}); }); });

A p element, let the mouse move over that element

Set mouse inhibit style

Description:

The cursor property defines the cursor shape used when the mouse pointer is placed within the bounds of an element.

When the attribute value of cursor attribute is "not-allowed," the mouse cursor shape is forbidden pattern.

Cursor property values are as follows, default value is default

crosshair;

crosshairs

Cursors appear as crosshairs

cursor: pointer;

cursor: hand;

Two are written to take care of IE5, which only recognizes hand.

hand

To indicate that there is a connection in the form of a pointer.

cursor: wait;

Wait/hourglass

Cursor indicates that the current program is busy (usually a watch or hourglass)

cursor: help;

help

Cursor to indicate current location for help (usually question mark or balloon)

cursor: no-drop;

unable to release

cursor: no-drop;

cursor: text;

Text/Edit

Cursor implies that the current position is text content

cursor: move;

movable object

Cursors suggest that something should be moved

cursor: n-resize;

Size North

Edge can be moved up (North)

cursor: s-resize;

Size Down (South)

Edge can move downward (south)

cursor: e-resize;

Size to the right (East)

box edge can be moved to the right (east) side

cursor: w-resize;

Size Left (West)

Edge can move left (west)

cursor: ne-resize;

Size up right (North East)

Cursor implies that the edge of the box can move to the upper right (northeast)

cursor: nw-resize;

Size up left (North West)

Edge can be moved to the left (northwest)

cursor: se-resize;

Size Down Right (South East)

Edge can be moved to the lower right (southeast)

cursor: sw-resize;

Size Down Left (South West)

Edge can be moved to left and down (SW)

cursor: auto;

automatic

Browser Set a Cursor

cursor:not-allowed;

prohibited

cursor:not-allowed;

cursor: progress;

treatment

cursor: progress;

cursor: default;

system default

Default cursor state (usually an arrow)

cursor: url(' # ');

# = cursor file address (note file format must be: .cur or.ani).

User-defined (animation available)

Customizing the url position of the cursor

Note: Add a generic cursor at the end of the custom cursor definition, in case those url-defined cursors cannot be used

You may say, cursor attribute value so many, how to remember it? In fact, you don't have to worry. In actual development, we generally only use the two attribute values of "default" and "pointer", and the others are rarely used. If you really don't need anything else, just come back and look up this list.

At this point, I believe that everyone has a deeper understanding of "jquery how to use CSS() to set the mouse ban style," may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report