原创 hover 右側的 | 隱藏
實現下圖所示效果 鼠標經過的時候沒有右側的 |。 一般的方法是用border-right。可是鼠標經過後一個a鏈接的時候,border-right還在。 後來想的是在a鏈接下面加span標籤,可是實現起來總是不對 a:hov
原创 css 實現蒙版效果
樣式: <style> .back {background:url(images/coupon-logo.gif) no-repeat;} .top {height:100px;background-color:#
原创 獲取地址欄特定字符後面的字符
var abouturl=location.href;//獲取地址 var str_after = abouturl.split("#")[1];//獲取後面字符 $("li").each(function ()
原创 input寬度隨文字變化而變化
<input type="text" class="form-control"> <script> var searchinput=$("input"); var textWidth = function (text) {
原创 手機左右上下滑動插件--iscroll.js
最近使用這個插件 來做下總結。 gethub官網地址:https://github.com/cubiq/iscroll/ 比較全的中文API:http://www.mamicode.com/info-detail-331827.
原创 滾動監聽實現
$.fn.smartFloat = function () { var position = function (element) { var top = element.offset()
原创 在移動端,body:overflow 無效的問題
在手機瀏覽器上,給body增加overflow:hidden;width:100%;height:100% 無效的問題。在網上找了幾種解決辦法 1、body加position:fixed; —-可行 2、給要滾動的元素添加一個
原创 wow.js 向下滾動動畫插件 使用說明
Wow是一個鼠標向下滾動,內容逐漸顯示的插件,它依賴animate.css 動畫(或者其他的動畫庫),功能類似 waypoints 插件。 Github地址:https://github.com/matthieua/WOW 使用
原创 將數組對象變成json字符串
最終結果輸出 是這種數組,如下圖: 代碼: var jsonData=""; for(var s in newData){ jsonData+='"'+s+'"'+
原创 aJax 表單提交代碼示例
話不多說,直接上代碼: <script> var formEle=jQuery("#message-form");//這裏是你的表單id var msgEle=jQuery("#message-tips");//這
原创 jq 計算div寬度--innerwidth,outerwidth,width
width()方法用於獲得元素寬度; innerWidth()方法用於獲得包括內邊界(padding)的元素寬度; outerWidth()方法用於獲得包括內邊界(padding)和邊框(border)的元素寬度; 如果ou
原创 jq插件寫法
(function ($) { var methods = { init: function (options) { // this }, show
原创 序列化表單出現亂碼--解決方法
console.log(decodeURIComponent($("#form").serialize())) decodeURIComponent 進行解碼 網址:www.w3school.com.cn/jsref/jsref_
原创 搜索框
實現回車/表單提交 ,剛纔輸入的內容 成爲一個關鍵詞,然後點擊可以關閉 的前端頁面。 效果如下圖。 所有代碼: <!DOCTYPE html> <html lang="en"> <head> <meta charset
原创 瀑布流 或者動態加載 click點擊無效的問題
將 $(".div").click(function(){ }); 改爲: $('body').on('click', '.div', function () {})