Constructing intelligent molecules for specific recognition of metal ions is critically important in environmental and biological fields. In this work, three novel triazine-quinoline-appended naphthalimide fluorescent sensors (NAK1, NAK2, NAK3) with different lengths of the linker were constructed. Research concerning the structure-fluorescence relationships of the three compounds showed that they exhibited distinct photophysical properties in either solution state or solid state. Compound NAK2, containing triazine-quinoline group with an ethylene (-CH2CH2-) linker, showed the strongest liquid state fluorescence emission, and it also displayed superior recognitive selectivity and sensitivity to Hg2+. NAK2 could detect Hg2+ within 2 min in phosphate buffer (PBS)/EtOH (v/v, 3/2) with low detection limit (0.045 μmol/L), being applied in Hg2+ detection in environmental water samples. Job's plot, 1H NMR and DFT calculations demonstrate that NAK2 combined with Hg2+ in 1:1 because of the special coordination holes, causing the change of planarity and electron transfer. This new type of molecular switch provides a new way of building high-performance fluorescence sensors.