A camera assembly, comprising: a fixed holder; a sliding means, connected to the fixed holder and configured to move relative to the fixed holder, wherein the sliding means comprises a magnet; a camera module, arranged on the sliding means and configured to move between a first position at which the camera module is extending out of the fixed holder and a second position at which the camera module is retracted into the fixed holder with movement of the sliding means; and an electromagnetic element, arranged on the fixed holder and configured to generate repulsive force and attractive force to the magnet to drive the sliding means to move, wherein the camera module is adapted to move between the first position and the second position; wherein the fixed holder comprises a guiding element extending along a moving direction of the sliding means; the sliding means further comprises: a main body, defining a first slot configured to receive the camera module; and a mating body, connected to the main body and configured to match with the guiding element to guide the movement of the sliding means; wherein the mating body defines at least one guiding hole, the guiding element comprises at least one guiding rod passing through the at least one guiding hole; characterized in that the fixed holder further comprises: a bottom plate, parallel to the moving direction of the sliding means; a first side plate, extending perpendicularly from an end of the bottom plate and defining a first opening; and a second side plate, extending perpendicularly from the other end of the bottom plate and opposite to the first side plate; wherein an end of the at least one guiding rod is connected to the first side plate, the other end of the at least one guiding rod is connected to the second side plate, the electromagnetic element is fixed on the second side plate, the second position is between the first side plate and the second side plate, the camera module is configured to extend out of or retract into the fixed holder through the first opening. a fixed holder; a sliding means, connected to the fixed holder and configured to move relative to the fixed holder, wherein the sliding means comprises a magnet; a camera module, arranged on the sliding means and configured to move between a first position at which the camera module is extending out of the fixed holder and a second position at which the camera module is retracted into the fixed holder with movement of the sliding means; and an electromagnetic element, arranged on the fixed holder and configured to generate repulsive force and attractive force to the magnet to drive the sliding means to move, wherein the camera module is adapted to move between the first position and the second position; wherein the fixed holder comprises a guiding element extending along a moving direction of the sliding means; the sliding means further comprises: a main body, defining a first slot configured to receive the camera module; and a mating body, connected to the main body and configured to match with the guiding element to guide the movement of the sliding means; wherein the mating body defines at least one guiding hole, the guiding element comprises at least one guiding rod passing through the at least one guiding hole; a main body, defining a first slot configured to receive the camera module; and a mating body, connected to the main body and configured to match with the guiding element to guide the movement of the sliding means; wherein the mating body defines at least one guiding hole, the guiding element comprises at least one guiding rod passing through the at least one guiding hole; characterized in that the fixed holder further comprises: a bottom plate, parallel to the moving direction of the sliding means; a first side plate, extending perpendicularly from an end of the bottom plate and defining a first opening; and a second side plate, extending perpendicularly from the other end of the bottom plate and opposite to the first side plate; a bottom plate, parallel to the moving direction of the sliding means; a first side plate, extending perpendicularly from an end of the bottom plate and defining a first opening; and a second side plate, extending perpendicularly from the other end of the bottom plate and opposite to the first side plate; wherein an end of the at least one guiding rod is connected to the first side plate, the other end of the at least one guiding rod is connected to the second side plate, the electromagnetic element is fixed on the second side plate, the second position is between the first side plate and the second side plate, the camera module is configured to extend out of or retract into the fixed holder through the first opening.